Simple Machines Community Forum

Customizing SMF => SMF Coding Discussion => Topic started by: BuzzBoy on December 15, 2005, 01:47:08 AM

Title: adding dynamic content to index.template.php
Post by: BuzzBoy on December 15, 2005, 01:47:08 AM
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.
Title: Re: adding dynamic content to index.template.php
Post by: BuzzBoy on December 15, 2005, 06:35:59 PM
...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
Title: Re: adding dynamic content to index.template.php
Post by: bloc on December 15, 2005, 07:22:09 PM
Are the paths to the content pages the right ones? Maybe you should include the whole path there instead.
Title: Re: adding dynamic content to index.template.php
Post by: BuzzBoy on December 15, 2005, 09:21:33 PM
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 :(
Title: Re: adding dynamic content to index.template.php
Post by: BuzzBoy on December 15, 2005, 11:47:06 PM
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
Title: Re: adding dynamic content to index.template.php
Post by: bloc on December 16, 2005, 07:06:43 AM
ah.. ;D those small errors...