| Re: custom block with smarty/php having problems |
| by pervigilo on 2006/7/27 9:55:49 OK, I see what you are saying now, but that in the custom block... I can't do that, as I need the php in the php file I am including in my block... Let me try and explain this again: ----------------------------------------------------------- My custom block looks like this: include("/home/myuser/www/trivia_engine.php"); type:PHP SCRIPT ------------------------------------------------------------ The surprising thing is that this block does work, it displays my php script, but the problem is that this php script is a trivia engine, so I have a < form > in the php script direct to another portion of the php script, and that is where I am having problems... The php script looks like this, where I am having problems: le="color: #000000"><?php <? php if (isset(SOMEVARIABLESTUFF)) { //Start Smarty if (!isset ($_SESSION)) { ini_set('session.save_path', $sessions_dir); session_start(); require('Smarty.class.php'); $trivia_engine = new Smarty; //assigning program directories for Smarty $trivia_engine->template_dir = './templates'; $trivia_engine->compile_dir = './templates_c'; $trivia_engine->config_dir = './configs'; //Call the variables from config file for use in PHP script $trivia_engine->config_load('trivia.conf'); $cfg_vars = $trivia_engine->get_config_vars(); extract($cfg_vars); } include("/home/myuser/www/xoops/mainfile.php"); include("/home/animeimm/www/xoops/header.php"); $trivia_engine->display('answer_single.tpl'); include("/home/animeimm/www/xoops/footer.php"); }; When I try to display this page, its blank, if I comment out the "include("/home/myuser/www/xoops/header.php");" the php shows up... if I comment out "$trivia_engine->display('answer_single.tpl');" my XOOPS page shows up, but no php stuff. I think I am going to go with what FrankBlack said, but if you have another good Idea, please submit it. Thanks again, |
| Re: custom block with smarty/php having problems |
| by McNaz on 2006/7/26 12:41:58 I can confirm that the following works in a block. le="color: #000000"><?php $xoopsTpl =& new XoopsTpl(); $test = $xoopsTpl->fetch('db:xproject_ticket_view.html'); echo $test; Content Type : PHP Script. xproject_ticket_view.html is a random template from my module. The template is then rendered in the block (minus the missing un-assigned values). So it does work. Cheers. |
| Re: custom block with smarty/php having problems |
| by pervigilo on 2006/7/26 11:21:33 Quote:
Tried that, no change :( |
| Re: custom block with smarty/php having problems |
| by McNaz on 2006/7/26 10:08:19 Quote: ok, I figured you couldn't, because of the problems with session management Actually... there might be a way. Try this. le="color: #000000"><?php $page = $xoopsTpl->fetch('something.tpl'); echo $page; The fetch works like display but renders the content into the $page variable. You then need to spit this out. PS. I have not tried this but it should work. HTH. Cheers. McNaz. |
| Re: custom block with smarty/php having problems |
| by pervigilo on 2006/7/26 9:24:20 ok, I figured you couldn't, because of the problems with session management :( well, it can't be perfect, right? :) Is there any documentation online for creating a new module? Thanks again :) |