PhpDig.net

PhpDig.net (http://www.phpdig.net/forum/index.php)
-   How-to Forum (http://www.phpdig.net/forum/forumdisplay.php?f=33)
-   -   A simple include in my php template doesn't appear (http://www.phpdig.net/forum/showthread.php?t=1197)

claudiomet 08-20-2004 01:39 PM

A simple include in my php template doesn't appear
 
I made a custom template in php based on gaagle.html template... works fine.

But, I put a simple include (with <? include("linksites.php") ?> ) in my template but the include doesn't appear...
¿what's wrong?

Charter 08-20-2004 01:47 PM

http://www.phpdig.net/showthread.php?threadid=348 ;)

claudiomet 08-20-2004 02:03 PM

I do that, but doesn't work. The content of the include is:

<? include('config.php');
$rs=mysql_db_query($db,"select * from recomendados order by id asc limit 50");
while($row=mysql_fetch_array($rs)){
echo'<p align="right"><a href="'.$row["direccion"].'" target="_blank">'.substr($row["titulo"],0,17).'</a></p>';
}
mysql_close($conectar);
?>


That shows a list of links stored in a database, but doesn't shows the links, only shows a partial and literal include code.

Charter 08-20-2004 02:26 PM

Did you make the custom search page like in this post?

claudiomet 08-23-2004 06:35 AM

Thanks!

Finally I found the solution:
In search_function.php, add the following code right after the function statement:

ob_start();
require("my_include.php");
$my_include = ob_get_contents();
ob_end_clean();

then, add my_include to array:

$t_mstrings = compact('my_include','powered_by_link','title_message','phpdig_version','re sult_message' ,'nav_bar','ignore_message','ignore_commess','pages_bar','previous_link','n ext_link','templates_links');

and insert <phpdig:my_include/> in the template file ... that's all.

Thanks a lot for your time Charter!


All times are GMT -8. The time now is 04:03 PM.

Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright © 2001 - 2005, ThinkDing LLC. All Rights Reserved.