Hey mensen.
Ik heb een probleem met een template systeem die problemen heeft met het includen van .php files or het lezen van custom variables. Het betreft de Smarty (http://smarty.php.net/) template systeem die standaard tegenwoordig in PAFileDB zit. Ik heb al een topic erover gescreven op het officiele Smarty forums maar haal daar weinig uit... als er al word gereageerd. Ik weet niet of het gepast is (en/of gewaardeerd word) maar ik zal de forum post quoten. (het is wel engels maar ik neem aan dat de meeste daar geen problemen mee zullen hebben.)
De reply hierop was simpel maar wel werkend.. voor zover dat kan.
Ik heb het geprobeerd en dit is wat ik er mee heb kunne bereiken.
Dus nu nogmaals de vraag..
Doe ik iets verkeerds of is het gewoon doodsimpel waar dat het niet gaat lukken omdat smarty het niet accepteerd dat ik php in een .tpl gebruik "no matter what" de omstandigheden of omwegen?
Als iemand wat licht zou kunnen schijnen op dit vervelende obstakel zou ik dat zwaar waarderen
Ik heb een probleem met een template systeem die problemen heeft met het includen van .php files or het lezen van custom variables. Het betreft de Smarty (http://smarty.php.net/) template systeem die standaard tegenwoordig in PAFileDB zit. Ik heb al een topic erover gescreven op het officiele Smarty forums maar haal daar weinig uit... als er al word gereageerd. Ik weet niet of het gepast is (en/of gewaardeerd word) maar ik zal de forum post quoten. (het is wel engels maar ik neem aan dat de meeste daar geen problemen mee zullen hebben.)
Hi there I have a problem with including a .php file or a variabe (created in index.php) when trying to include it into any .tpl file. I have tried several ways and i just dont know how to anymore. Thing is i am trying to build cutenews into pafiledb wich is using smarty's template system as you know im sure Wink. And it just does not want to show whatever i try. There is a way.. wich is to code it right into news.php act and it will show, but above the header and thats surely not what i was aiming for. Index.php Variable Setting Code: //News Includer $show_news->display('./news/show_news.php'); I tried both PHP includes and Smarty's such as {$show_news} and the other "suggested" ways to incorporate the variable into a template. For now when i use this code i only get.. (Also when i use include as variable setting instead of display) Code: Fatal error: Call to a member function display() on a non-object in WWW\index.php on line 68 Even if it does work it just goes blank on me and just show everything except ofcourse the include. Is there any way i can get this to work? I kinda dont want my news to be above my header so if anyone knows a way i can go around all this i would be very thankfull. Many thanks in advance Kevin. |
De reply hierop was simpel maar wel werkend.. voor zover dat kan.
According to the error message the variable $show_news isn't a smarty object, so has no display() method, so it is more than clear you get absolutely no results. Additionally, you have to use the $smarty->display() method with a template name, not a PHP script that has to be included.h |
Ik heb het geprobeerd en dit is wat ik er mee heb kunne bereiken.
Ok... I just tried it like you said and i do get outcome.. only thing is i cant get it to work for 2submaps above.. If i put the news map inside the template map it will call. But it seems that anything i include through a .tpl file will fail to execute. Code being used... (and yes it works i have tested it without php also) Code: //News Includer $smarty->display('news/show_news.php', $show_news); I used the {$show_news} again ofcourse as this "should" work with php as far as i know ;/ This time i got this... Code: Fatal error: Smarty error: [in news/show_news.php line 14]: syntax error: unrecognized tag: include("$cutepath/data/rss_config.php"); (Smarty_Compiler.class.php, line 436) in WWW\includes\smarty\Smarty.class.php on line 1095 Strange? I kinda like to think so yes. I dont know what to do anymore. I have limited coding skills so i am running out of options. In my eyes it is only delaying the point of not executing variables inside a .php file... Wich brings me back to the point that "why" if it "should" work it just wont show... and if it "should" work on the "smarty" way it breaks up cause it cant read it? If anyone can lead me a bit i would be very thankfull. Thanks in advance once again. |
Dus nu nogmaals de vraag..
Doe ik iets verkeerds of is het gewoon doodsimpel waar dat het niet gaat lukken omdat smarty het niet accepteerd dat ik php in een .tpl gebruik "no matter what" de omstandigheden of omwegen?
Als iemand wat licht zou kunnen schijnen op dit vervelende obstakel zou ik dat zwaar waarderen