4images Forum & Community

4images Modifications / Modifikationen => Templates & Styles (Requests & Discussions) => Topic started by: adrian.gab on July 10, 2007, 10:42:10 AM

Title: dynamic code (tags) does not run in an include file called from a template file
Post by: adrian.gab on July 10, 2007, 10:42:10 AM
Hi All,

Within my template files e.g. home.html or details.html, I would like to do a php include for a file to be included on the template.

The include part works fine, however I am finding that any of the dynamic 4images code is not being executed or carried out if they are in the include file. They appear to only run if they are in the main template files e.g. home.html, details.html etc. When I say dynamic parts I mean the bits that are dynamic within the template files that are enclosed by the curly brackets {} e.g.

{template_url}
{if random_image}
{site_name}

For example in home.html, I have the following snippet of code in the template:

     <?PHP
   $special_include_file = "./templates/default/simplified/test.php";
   Include($special_include_file); 
   ?>


And in the include file (test.php) I have:

     <img src="{template_url}/images/spacer.gif" alt="" width="4" height="4" />
     <?PHP
     Echo “php is working”;
     ?>



When the page is generated on the webserver, if I look at the page source code, this is what I get:

     <img src="/images/spacer.gif" alt="" width="4" height="4" />
     php is working


You can see that the php in the include is executed fine but the 4images dynamic part did not e.g. {template_url}

Any help would be greatly appreciated.

Thanks,
Adrian
Title: Re: dynamic code (tags) does not run in an include file called from a template file
Post by: KurtW on July 10, 2007, 08:07:58 PM
Hi,

Is your test.php from the Magier Copperfield.


And is this all code in your test.php :?: :?: :?:
Quote
    <img src="{template_url}/images/spacer.gif" alt="" width="4" height="4" />
     <?PHP
     Echo “php is working”;
     ?>

This is only a primitive php file with no contact to infos/tags from 4images.
What do you like to do with your new php file?


Kurt
Title: Re: dynamic code (tags) does not run in an include file called from a template file
Post by: mawenzi on July 10, 2007, 08:12:57 PM
... the answer to adrian.gab  ...
http://www.4homepages.de/forum/index.php?topic=4295.msg95832#msg95832
Title: Re: dynamic code (tags) does not run in an include file called from a template f
Post by: adrian.gab on July 10, 2007, 11:52:43 PM
it was just an simple example to show you what i was trying to do:

A) call a file from a template file using php include
B) get 4images to execute the tags in that include file

the include file did have a tag in it, it was {template_url}. i was just proving very simply that the tag wasn't be executed.

i would still like to know if there is a way to get the tags working within an include file called from a template file e.g. home.html
Title: Re: dynamic code (tags) does not run in an include file called from a template file
Post by: mawenzi on July 11, 2007, 12:08:00 AM
... you must include the php-file in which the tags are generated in your new php-file which you want to include ...
... like global.php in all main.php-files in 4images ...