Adding new template but it's not compiled [message #29128] |
Thu, 01 December 2005 04:18 |
MadJack
Messages: 19 Registered: November 2005 Location: Qc
Karma: 0
|
Junior Member |
|
|
What I'm trying to do is modify the index.tmpl so a link is displayed to open a page.
That page will contain a JIRC Applet customized for each logged in user or a random username if the user is anonymous.
I've read the template help post and search the forum and read the docs but I'm stumped.
Here's what I did:
In the index.tmpl I added:
Quote: |
....... SNIPPED .......
{TEMPLATE: usercp}
<br /><div class="ac">
<!-- This part -->
<table class="Chat" border="1" cellspacing="2" cellpadding="3"><tr><td class="wht"><a class="fb" href="{TEMPLATE: chatlink}">
ST: Unity Chat Room</a></td></tr></table></div><br />
<!-- up to here -->
{IF: _uid}<span class="GenText">{MSG: welcome_message}</span><br />{ENDIF}
....... SNIPPED .......
|
{TEMPLATE: chatlink} is defined as:
Quote: | {SECTION: chatlink}
{ROOT}?t=chat&{DEF: _rsid}
{SECTION: END}
|
Pretty simple.
chat.tmpl contains:
Quote: | {PHP_FILE: input: chat.php.t; output: chat.php;}
{REF: security.tmpl}
{REF: logedin.tmpl}
{REF: footer.tmpl}
{REF: curtime.tmpl}
{REF: stats.tmpl}
{REF: show.tmpl}
{REF: quicklogin.tmpl}
{PAGE: CHATPAGE}
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>{GVAR: FORUM_TITLE}{VAR: TITLE_EXTRA}</title>
{META-CONTENT-LANGUAGE}
<BASE HREF="{FULL_ROOT}">
<script language="javascript" src="lib.js" type="text/javascript"></script>
<link rel="StyleSheet" href="{THEME_ROOT}/forum.css" type="text/css" media="screen" title="Default FUDforum Theme">
</head>
<body>
{TEMPLATE: usercp}
{IF: _uid}<span class="GenText">{MSG: welcome_message}</span><br />{ENDIF}
<table class="wa" border="0" cellspacing="3" cellpadding="5"><tr><td class="ForumBackground">
<br /><div class="ac"><table class="Chat" border="1" cellspacing="2" cellpadding="3"><tr><td class="wht">
{VAR: ChatApplet}
</td></tr></table></div><br />
{IF: __fud_real_user__}{TEMPLATE: quick_login_loged_in}{ELSE}{TEMPLATE: quick_login_on}{END}
{IF: $logedin || $forum_info}{TEMPLATE: loged_in_list}{ENDIF}
{TEMPLATE: curtime}
{TEMPLATE-DATA: page_stats}
{TEMPLATE: footer}
{PAGE: END}
|
chat.php.t contains:
Quote: | /*{PRE_HTML_PHP}*/
$TITLE_EXTRA = ': {MSG: chat_title}';
/*{POST_HTML_PHP}*/
$ChatApplet = '<applet code=IRCApplet.class archive='irc.jar,pixx.jar' width=640 height=400>
<param name='CABINETS' value='irc.cab,securedirc.cab,pixx.cab'>
<param name='nick' value='{VAR: usr->alias}'>
<param name='alternatenick' value='Anon-???'>
<param name='fullname' value='{VAR: usr->alias}'>
<param name='host' value='irc.freenode.net'>
<param name='gui' value='pixx'>
<param name='quitmessage' value='Onward!'>
<param name='asl' value='false'>
<param name='useinfo' value='false'>
<param name='command1' value='/join #ST-Unity'>
<param name='command2' value='/msg nickserv IDENTIFY Jysuis6'>
<param name='authorizedjoinlist' value='#ST-Unity'>
<param name='style:bitmapsmileys' value='true'>
<param name='style:smiley1' value=':) img/sourire.gif'>
<param name='style:smiley2' value=':-) img/sourire.gif'>
<param name='style:smiley3' value=':-D img/content.gif'>
<param name='style:smiley4' value=':d img/content.gif'>
<param name='style:smiley24' value=':D img/content.gif'>
<param name='style:smiley5' value=':-O img/OH-2.gif'>
<param name='style:smiley6' value=':o img/OH-1.gif'>
<param name='style:smiley7' value=':-P img/langue.gif'>
<param name='style:smiley8' value=':p img/langue.gif'>
<param name='style:smiley26' value=':P img/langue.gif'>
<param name='style:smiley9' value=';-) img/clin-oeuil.gif'>
<param name='style:smiley10' value=';) img/clin-oeuil.gif'>
<param name='style:smiley11' value=':-( img/triste.gif'>
<param name='style:smiley12' value=':( img/triste.gif'>
<param name='style:smiley13' value=':-| img/OH-3.gif'>
<param name='style:smiley14' value=':| img/OH-3.gif'>
<param name='style:smiley15' value=':'( img/pleure.gif'>
<param name='style:smiley16' value=':$ img/rouge.gif'>
<param name='style:smiley17' value=':-$ img/rouge.gif'>
<param name='style:smiley18' value='(H) img/cool.gif'>
<param name='style:smiley19' value='(h) img/cool.gif'>
<param name='style:smiley20' value=':-@ img/enerve1.gif'>
<param name='style:smiley21' value=':@ img/enerve2.gif'>
<param name='style:smiley22' value=':-S img/roll-eyes.gif'>
<param name='style:smiley25' value=':S img/roll-eyes.gif'>
<param name='style:smiley23' value=':s img/roll-eyes.gif'>
<param name='style:backgroundimage' value='false'>
<param name='style:backgroundimage1' value='all all 0 background.gif'>
<param name='style:sourcefontrule1' value='all all Serif 12'>
<param name='style:floatingasl' value='true'>
<param name='pixx:timestamp' value='true'>
<param name='pixx:highlight' value='true'>
<param name='pixx:highlightnick' value='true'>
<param name='pixx:nickfield' value='true'>
<param name='pixx:styleselector' value='true'>
<param name='pixx:setfontonstyle' value='true'>
</applet>'
/*{POST_PAGE_PHP_CODE}*/
?>
{TEMPLATE: CHATPAGE}
|
If I {REF: chat.tmpl} in index.tmpl fud will inline the page which I don't want it to, obviously. It will generate the chat.php file but clicking on it will give a white page.
I thought simply having the .tmpl in the theme directory would have it compiled but it seems this is not the case so I'm guessing it has to be included (or REF'ed if you prefer) somewhere but trying to do so gave me white pages...
From what I could read I'm doing it right. The link does display when browsing the index but clicking on it brings the normal index page. Obviously the chat.php isn't generated since it's not in the theme directory. (I rename the chat.php before rebuilding so it doesn't lead to false results)
I need to have the chat.tmpl and chat.php.t to be compiled and called using index.php?t=chat&rid=X
Maybe I've worked on it for so long that I'm blind to see... Anyway, a hand would be appreciated.
Thanks.
|
|
|
Re: Adding new template but it's not compiled [message #29140 is a reply to message #29128] |
Thu, 01 December 2005 15:48 |
Ilia
Messages: 13241 Registered: January 2002
Karma: 0
|
Senior Member Administrator Core Developer |
|
|
Your PHP script contains parser errors, you are enclosing the string in single quotes and then using single quotes inside it. I recommend you create the string by using heredoc syntax.
FUDforum Core Developer
|
|
|
|
|
|
Re: Adding new template but it's not compiled [message #29174 is a reply to message #29172] |
Fri, 02 December 2005 17:11 |
Ilia
Messages: 13241 Registered: January 2002
Karma: 0
|
Senior Member Administrator Core Developer |
|
|
REF is definately not required for a tmpl file to be built. If you have a .tmpl file and it hash {PHP_FILE:} component in it, it will be built as long as .tmpl file is present in the tmpl/ directory of the theme you are building.
FUDforum Core Developer
|
|
|
|
Re: Adding new template but it's not compiled [message #29176 is a reply to message #29175] |
Fri, 02 December 2005 17:26 |
Ilia
Messages: 13241 Registered: January 2002
Karma: 0
|
Senior Member Administrator Core Developer |
|
|
You can debug the issue by adding debug code to the compile_all() function inside compilter.inc, specifically the code inside the
<?php foreach (glob($GLOBALS['DATA_DIR'].'/thm/default/tmpl/*.tmpl') as $fe) { ?>
loop.
FUDforum Core Developer
|
|
|
|
|
|
|
|
|
Re: Adding new template but it's not compiled [message #29248 is a reply to message #29246] |
Mon, 05 December 2005 19:38 |
Ilia
Messages: 13241 Registered: January 2002
Karma: 0
|
Senior Member Administrator Core Developer |
|
|
The CVS version does not have the leading / already, so this change was not necessary.
If a template file is added to the default theme it will appear in other themes as well.
FUDforum Core Developer
|
|
|