include a script

General questions about CMSimple
bastingse
Posts: 243
Joined: Fri Jun 06, 2008 9:38 pm
Location: Netherlands
Contact:

include a script

Postby bastingse » Sat Sep 17, 2016 9:43 am

Folks, i do need some help. Hope anybody can advice me right here:

I'm creating a website and i include a sort of 'yelow page' script on a page:
http://infobergterblijtviltgeulhem.nl/?Bedrijven

To include this script the builder telling me to add this to the top of the template:

Code: Select all

<?php
ob_start();
?>


And then add this line to the bottom:

Code: Select all

<?php include '/home/ondernemer/domains/infobergterblijtviltgeulhem.nl/public_html/bedrijven/app/views/pjLayouts/pjActionListings.php'; ?>


Then i need to add this line in the template where the script should appear, so above or under the content:

Code: Select all

{YP_LISTINGS}


The result looks fine as you can see on:
http://infobergterblijtviltgeulhem.nl/?Bedrijven

I want this script be loaded only on this page: ?Bedrijven
So i created 2 templates. 1 with the script for the page ?Bedrijven, and 1 template without the script for all other pages.
The template with the script included i use as default template, the other template without the script i use for each page separately.
Now, when i click on a company to read more about it, the script should show more information but instead of that it points to the index of cmsimple (the home page) and is showing nothing else then the homepage.
Just for testing i did use the template WITH the script include also for the Homepage so that you can see the result.
But why are we going back to the index when i click on more info about a company ??
Strange thing is that when i log in to cmsimple and do testing, then all works fine. I click on 'Read more (lees meer)' and the info is showing. But soon as i log out it points to the homepage.

Any idea how to solve this??? No..... i do not want to use an iframe :-)

Thanks already!

Tata
Posts: 2528
Joined: Tue May 20, 2008 5:34 am
Location: Slovakia
Contact:

Re: include a script

Postby Tata » Sat Sep 17, 2016 10:40 am

You don't need two templates.
1. Use a variable in the template for (I suppose) a newsbox in which the script shall appear.

Code: Select all

<div id="change_div_content">
     <?php if($change_div_content=='') {
          echo newsbox('any_other_common_content_page');
          } else {
          echo newsbox($change_div_content);
     }?>
</div>

2. Create a hidden page with desired content - e.g. my_special_hidden_page.
3. Then on the page to which the desired content shall appear insert

Code: Select all

{{{$change_div_content = "my_special_hidden_page"};}}} 

So you'll get one sontent for all but the only apointed page and the one special page will be shown with the desired content in the newsbox.

Not tested right now, but used moretimes before. Should work.
Or have a look here> http://3-magi.net/?CMSimple_XH/Coco_XH
CMSimple.sk
It's no shame to ask for an answer if all efforts failed.
But it's awful to ask without any effort to find the answer yourself.

cmb
Posts: 12036
Joined: Tue Jun 21, 2011 11:04 am
Location: Mü-Sa, RLP, DE
Contact:

Re: include a script

Postby cmb » Sat Sep 17, 2016 11:20 am

bastingse wrote:But why are we going back to the index when i click on more info about a company ??

Because the script creates a link which simply omits the current page. When I'm on http://infobergterblijtviltgeulhem.nl/?Bedrijven the link "Lees meer" points to http://infobergterblijtviltgeulhem.nl/index.php?controller=pjListings&action=pjActionView&id=1 instead of http://infobergterblijtviltgeulhem.nl/index.php?Bedrijven&controller=pjListings&action=pjActionView&id=1. That would have to be fixed in the script.
Christoph M. Becker –Plugins for CMSimple_XH, but not for CMSimple 4+

bastingse
Posts: 243
Joined: Fri Jun 06, 2008 9:38 pm
Location: Netherlands
Contact:

Re: include a script

Postby bastingse » Sat Sep 17, 2016 5:04 pm

Thanks a lot you professionals! thanks a lot. Going to try this later on today tomorrow!
Much appreciated!

bastingse
Posts: 243
Joined: Fri Jun 06, 2008 9:38 pm
Location: Netherlands
Contact:

Re: include a script

Postby bastingse » Sun Sep 18, 2016 7:05 am

Tata wrote:

Code: Select all

{{{$change_div_content = "my_special_hidden_page"};}}}


I did give it a try. What i did was the following:
I add this to the template:

Code: Select all

<div id="change_div_content">
     <?php if($change_div_content=='') {
          echo newsbox('Tekst');
          } else {
          echo newsbox($change_div_content);
     }?>
</div>


Then i created 3 pages:
1. hidden page 'Tekst'
2. hidden page 'Bedrijvenscript'
3. page 'Bedrijven'

On page 'Bedrijven' i added this code:

Code: Select all

{{{$change_div_content = "Bedrijvenscript"};}}}

So this should show the page 'Bedrijvenscript' and on other pages it should show 'Tekst'.

Unfortunately that didn't work :cry: as you can see on http://infobergterblijtviltgeulhem.nl/i ... ?Bedrijven
What did i do wrong??

Tata
Posts: 2528
Joined: Tue May 20, 2008 5:34 am
Location: Slovakia
Contact:

Re: include a script

Postby Tata » Sun Sep 18, 2016 8:10 am

Try the old function call

Code: Select all

#CMSimple $change_div_content = "Bedrijvenscript"};#

It has worked for me for years. Now there is a return in debug report
Parse error: syntax error, unexpected '=' in /Users/msereday/Sites/clear-167/cmsimple/functions.php(184) : eval()'d code on line 1

I don't know why it doesn't work now.
Last edited by Tata on Sun Sep 18, 2016 8:37 am, edited 1 time in total.
CMSimple.sk
It's no shame to ask for an answer if all efforts failed.
But it's awful to ask without any effort to find the answer yourself.

bastingse
Posts: 243
Joined: Fri Jun 06, 2008 9:38 pm
Location: Netherlands
Contact:

Re: include a script

Postby bastingse » Sun Sep 18, 2016 8:21 am

Tata wrote:Try the old function call


unfortunately that did not work either

Tata
Posts: 2528
Joined: Tue May 20, 2008 5:34 am
Location: Slovakia
Contact:

Re: include a script

Postby Tata » Sun Sep 18, 2016 8:53 am

I tried it again on another local page.
On the first page I put

Code: Select all

#cmsimple $mybox="News04";#    

and in template

Code: Select all

<?php if($mybox == "") {
  echo newsbox("News01");
  }else{
  echo newsbox($quote);
}
?>


and it works as expected. With the first page e.g. News04 is shown in the box. Else the News01.
CMSimple.sk
It's no shame to ask for an answer if all efforts failed.
But it's awful to ask without any effort to find the answer yourself.

cmb
Posts: 12036
Joined: Tue Jun 21, 2011 11:04 am
Location: Mü-Sa, RLP, DE
Contact:

Re: include a script

Postby cmb » Sun Sep 18, 2016 9:34 am

Tata wrote:Try the old function call

Code: Select all

#CMSimple $change_div_content = "Bedrijvenscript"};#

It has worked for me for years. Now there is a return in debug report
Parse error: syntax error, unexpected '=' in /Users/msereday/Sites/clear-167/cmsimple/functions.php(184) : eval()'d code on line 1

I don't know why it doesn't work now.

This has nothing to do with CMSimple(_XH), but rather is caused by a change in PHP 7.0.0. Formerly, parse errors in eval()'d code were suppressed; now they show up. In this case I'm not sure why this error was reported; probably some hidden HTML markup has sneaked into the CMSimple scripting.
Christoph M. Becker –Plugins for CMSimple_XH, but not for CMSimple 4+

Tata
Posts: 2528
Joined: Tue May 20, 2008 5:34 am
Location: Slovakia
Contact:

Re: include a script

Postby Tata » Sun Sep 18, 2016 9:45 am

Have a look at http://cmsimplexh167.cmsimple.sk/ and browse all H1 links in TOC.
Password in PM
CMSimple.sk
It's no shame to ask for an answer if all efforts failed.
But it's awful to ask without any effort to find the answer yourself.


Return to “General”

Who is online

Users browsing this forum: No registered users and 1 guest