Author Topic: dynamic code (tags) does not run in an include file called from a template file  (Read 8399 times)

0 Members and 1 Guest are viewing this topic.

Offline adrian.gab

  • Newbie
  • *
  • Posts: 10
    • View Profile
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
« Last Edit: July 10, 2007, 01:55:42 PM by adrian.gab »

Offline KurtW

  • 4images Guru
  • *******
  • Posts: 2.778
    • View Profile
    • Malediven-Bilder ~~Dreams~~
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

Offline mawenzi

  • 4images Moderator
  • 4images Guru
  • *****
  • Posts: 4.500
    • View Profile
Your first three "must do" before you ask a question ! ( © by V@no )
- please read the Forum Rules ...
- please study the FAQ ...
- please try to Search for your answer ...

You are on search for top 4images MOD's ?
- then please search here ... Mawenzi's Top 100+ MOD List (unsorted sorted) ...

Offline adrian.gab

  • Newbie
  • *
  • Posts: 10
    • View Profile
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

Offline mawenzi

  • 4images Moderator
  • 4images Guru
  • *****
  • Posts: 4.500
    • View Profile
... 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 ...
Your first three "must do" before you ask a question ! ( © by V@no )
- please read the Forum Rules ...
- please study the FAQ ...
- please try to Search for your answer ...

You are on search for top 4images MOD's ?
- then please search here ... Mawenzi's Top 100+ MOD List (unsorted sorted) ...