PDA

View Full Version : Integrate a .tpl variable in a php file


bender
02-21-2007, 04:15 PM
Hello,

I would like to know if it's possible to use a variable of a .tpl file in php.

Example:

Here is the variable {cat.ID} which gives me a login (number) that I would like to use in a php request.


{php}
$sql="SELECT * from PLD_CATEGORY WHERE PARENT_ID={cat.ID} LIMIT 1";
$result = mysql_query($sql) or die("Requete erronee");
while($val = mysql_fetch_array($result)) {
.....
.....
}
{/php}

I would like to use the variable {cat.ID} in my SQL request and integrate the all in a .tpl file.
Do you know how to do ?

Thank you for your help.

James
02-21-2007, 04:32 PM
cat.id should be set someplace in the php file that is calling the tpl file.

so you would add the code perfroming the query to the php file in the section that contains the cat.id .
assign the result(s) to a variable in the php file and then call it in the tpl.

PHPLDrocks
02-27-2007, 06:57 PM
How can I integrate phpLD into wordpress template ?

Boby
02-27-2007, 07:22 PM
The best thing would be to make them both look the same.