Simple Machines Community Forum

Customizing SMF => SMF Coding Discussion => Aiheen aloitti: BuzzBoy - joulukuu 15, 2005, 01:47:08 AP

Otsikko: adding dynamic content to index.template.php
Kirjoitti: BuzzBoy - joulukuu 15, 2005, 01:47:08 AP
Hi - I have three php content files...I tried various methods of include with out success - well sort of. I was able to display one of the files, but what i am trying to do is have it so the user would click a link and say content #1 shows, click on another and #2 will show in place of #1, etc and so on for #3. reloading the page to show content is ok - I wanted to use a drop down menu for the links...the menu is not the issue it was the include array i was having trouble with...

<?
 
  if (strstr ($_GET["info"], 'q')) include('../content2.php');
elseif (strstr ($_GET["info"], 'p')) include('../content3.php');
elseif (strstr ($_GET["info"], 'o')) include('../content4.php');
else include('content1.php')

?>


the link looks like http://www.site.com/folder/index?info=q

Anyone please help...
Thank you.
Otsikko: Re: adding dynamic content to index.template.php
Kirjoitti: BuzzBoy - joulukuu 15, 2005, 06:35:59 IP
...does anyone have any suggestions? This code works in other php pages of my site, but not in the index.template.php of SMF.

Thanks
Otsikko: Re: adding dynamic content to index.template.php
Kirjoitti: bloc - joulukuu 15, 2005, 07:22:09 IP
Are the paths to the content pages the right ones? Maybe you should include the whole path there instead.
Otsikko: Re: adding dynamic content to index.template.php
Kirjoitti: BuzzBoy - joulukuu 15, 2005, 09:21:33 IP
Hi, I tried both ways for the path - I was able to include and show one file as an include , no prob, but when i tried to set it up this way it would not work...I got a template error  :( The code in the sample does work in any other php page of my site every time...but will not work from the index.template.php :(
Otsikko: Re: adding dynamic content to index.template.php
Kirjoitti: BuzzBoy - joulukuu 15, 2005, 11:47:06 IP
Ok, ok...sorry! I found my dumb mistake - I have a bad cold right now and the meds just plain old got to me. Thank you for helping.

I did not need <? and ?>

Works perfectly as I wanted... 8) :P ;D
Cheers
Otsikko: Re: adding dynamic content to index.template.php
Kirjoitti: bloc - joulukuu 16, 2005, 07:06:43 AP
ah.. ;D those small errors...