From: Paul M. <pmm...@gm...> - 2005-06-08 22:58:00
|
Hello. I have searched for this information, but I can't seem to find it anywhere, although I believe it to be possible. I want to modify template files with a 1.2.7 clean install. Essentially, I want to 'wrap' the wiki with elements form an existing webpage (common headers, footer, ads, etc). I have changed the template extension to .php and changed the reference to it in config.php. It loads the template as-is with the new extension perfectly. The problem is that the new php code I am now inserting into it is not getting executed. I have a require() at the top of the renamed template file, and then I run a few custom canned functions from this included file (adRotate(), displayUsers(), etc). None of these execute properly when run from within the .php template. Do I need to make any other changes to execute php code in the template? This should (I think) be very straightforward but I can't find any information about executing code on the WIKI itself or in this mailist archives. Thanks in advance, Paul |
From: Reini U. <ru...@x-...> - 2005-06-09 16:54:55
|
> I want to modify template files with a 1.2.7 clean install. with phpwiki-1.2.x php code is forbidden inside templates. you have to use something higher than 1.3.6 or so. before we just replaced some magic vars in the template string and dumped that to the client. now we eval the template. > Essentially, I want to 'wrap' the wiki with elements form an existing > webpage (common headers, footer, ads, etc). that's ok. > I have changed the template extension to .php and changed the > reference to it in config.php. It loads the template as-is with the new > extension perfectly. The problem is that the new php code I am now > inserting into it is not getting executed. see above. not possible. > I have a require() at the top of the renamed template file, and then I > run a few custom canned functions from this included file (adRotate(), > displayUsers(), etc). None of these execute properly when run from > within the .php template. > > Do I need to make any other changes to execute php code in the > template? This should (I think) be very straightforward but I can't > find any information about executing code on the WIKI itself or in this > mailist archives. -- Reini Urban http://phpwiki.org/ http://xarch.tu-graz.ac.at/home/rurban/ |
From: Reini U. <ru...@x-...> - 2005-06-13 05:43:51
|
Paul Mennega schrieb: > Sorry, one follow up question... > > When I try to include a file that has a number of pre-defined > functions in it, (I am including thei file at the top of html.tmpl, I > get a bunch of errors when this file is called from other elements I > am including in body.tmpl, etc. > > /include/common.php (In template 'body') (In template 'html'):438: > Notice[8]: Undefined index: MemberName Index of what? > MemberName is actually a cookie, used in a query on line 428 as > $_COOKIE['MemberName']. $_COOKIE is only defined for php > 4.3 $HTTP_COOKIE_VARS is only defined globally, not locally. Inside functions you have to global $HTTP_COOKIE_VARS or use $_COOKIE. > Any ideas what I have done wrong, or are user-defined functions not > executed properly from phpwiki templates? -- Reini Urban http://xarch.tu-graz.ac.at/home/rurban/ http://phpwiki.org/ |
From: Reini U. <ru...@x-...> - 2005-06-13 17:58:41
|
Paul Mennega sagte: > 2005/6/12, Reini Urban <ru...@x-...>: >> Paul Mennega schrieb: >> > Sorry, one follow up question... >> > >> > When I try to include a file that has a number of pre-defined >> > functions in it, (I am including thei file at the top of html.tmpl, = I >> > get a bunch of errors when this file is called from other elements I >> > am including in body.tmpl, etc. >> > >> > /include/common.php (In template 'body') (In template 'html'):438: >> > Notice[8]: Undefined index: MemberName >> >> Index of what? > > Exactly... All I am doing is referencing a cookie in my .php file > that I included into the body.tmpl. $_COOKIE("MemberName"); you mean $_COOKIE["MemberName"] > The above is the error that I get. > >> >> > MemberName is actually a cookie, used in a query on line 428 as >> > $_COOKIE['MemberName']. >> >> $_COOKIE is only defined for php > 4.3 >> $HTTP_COOKIE_VARS is only defined globally, not locally. >> Inside functions you have to global $HTTP_COOKIE_VARS or use $_COOKIE. >> > > I am using $_COOKIE. These functions I am including work like a charm > everywhere else on my site, but when included into the body.tmpl, I > get all kinds of these 'Unknown Index' error messages. > >> > Any ideas what I have done wrong, or are user-defined functions not >> > executed properly from phpwiki templates? > > I appreciate your help. I spent 15 hours this weekend pulling my hair > out trying to get this to work, with no luck. All I want to do is > modify body.tmpl so that I can include my common website header (logo, > etc.) One of the things that this included file does is displays one > set of content if the user is logged in, another if not. That is what > I store in the cookies, but this is simply not handling it... so > should I change all $_COOKIE references to a globalled > $HTTP_COOKIE_VARS? Or is there a way to modify the way the wiki > parses the templates to allow me to use $_COOKIE? > > Sorry for the questions, I have looked everywhere and can't find > ANYTHING about this issue, but it must have come up before... You just experience basic php problems. phpwiki does not interfere with that. Look at your /include/common.php and guard the $_COOKIE['MemberName'] reference with if (isset($_COOKIE['MemberName'])) blabla... otherwise you'll get these warnings, aeh notice. |