FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » FUDforum » How To » template question: category name/id and topic name in post.tmpl?
Show: Today's Messages :: Unread Messages :: Show Polls :: Message Navigator
| Subscribe to topic | Bookmark topic 
Switch to threaded view of this topic Create a new topic Submit Reply
template question: category name/id and topic name in post.tmpl? [message #160569] Tue, 29 September 2009 23:37 Go to next message
qubodup is currently offline  qubodup   Germany
Messages: 24
Registered: February 2008
Karma: 0
Junior Member
add to buddy list
ignore all messages by this user
Hello,

I'm working on a template, in which I would like to have a "breadcrumb" on (nearly) every page, including the "post a reply" page, where I want to see the index, category, forum and thread title (which I reply to) in a breadcrumb.

However, it appears that I cannot put my hands on the "message title", "category title" and "category id" variables, as $frm is defined without these variables in src/post.php.t .

Am I correct? Or do I actually have access to these variables and just didn't notice?

Is there a way to get these variables from a theme file (inside a {FUNC: } maybe)?

If there is no way, I would of course recommend these variables to be included in $frm in a future version of post.php.t of course Smile
Re: template question: category name/id and topic name in post.tmpl? [message #160578 is a reply to message #160569] Thu, 01 October 2009 02:26 Go to previous messageGo to next message
naudefj is currently offline  naudefj   South Africa
Messages: 3624
Registered: December 2004
Karma: 17
Senior Member
Administrator
Core Developer
remove from buddy list
ignore all messages by this user
Not sure, you will have to var_dump() the variables to see what's available. If it's not there, you can simply SELECT the data into variables from src/post.php.t.

For example, to dump all variables:
echo "<pre>"; var_dump( get_defined_vars() ); die();
Re: template question: category name/id and topic name in post.tmpl? [message #160579 is a reply to message #160578] Thu, 01 October 2009 10:00 Go to previous messageGo to next message
naudefj is currently offline  naudefj   South Africa
Messages: 3624
Registered: December 2004
Karma: 17
Senior Member
Administrator
Core Developer
remove from buddy list
ignore all messages by this user
Here is a patch:

Index: src/post.php.t                                                                                                                                                
===================================================================                                                                                                  
RCS file: /forum21/install/forum_data/src/post.php.t,v                                                                                                               
retrieving revision 1.161                                                                                                                                            
diff -u -a -r1.161 post.php.t                                                                                                                                        
--- src/post.php.t      29 Jan 2009 18:37:17 -0000      1.161                                                                                                        
+++ src/post.php.t      1 Oct 2009 13:59:28 -0000
@@ -58,7 +58,7 @@
        } else {
                std_error('systemerr');
        }
-       $frm = db_sab('SELECT id, name, max_attach_size, forum_opt, max_file_attachments, post_passwd, message_threshold FROM {SQL_TABLE_PREFIX}forum WHERE id='.$frm_id);
+       $frm = db_sab('SELECT id, cat_id, name, max_attach_size, forum_opt, max_file_attachments, post_passwd, message_threshold FROM {SQL_TABLE_PREFIX}forum WHERE id='.$frm_id);
        if (!$frm) {
                std_error('systemerr');
        }


Index: thm/default/tmpl/post.tmpl
===================================================================
RCS file: /forum21/install/forum_data/thm/default/tmpl/post.tmpl,v
retrieving revision 1.88
diff -u -a -r1.88 post.tmpl
--- thm/default/tmpl/post.tmpl  9 Sep 2009 16:15:00 -0000       1.88
+++ thm/default/tmpl/post.tmpl  1 Oct 2009 13:59:28 -0000
@@ -15,6 +15,7 @@
 {REF: curtime.tmpl}
 {REF: usercp.tmpl}
 {REF: stats.tmpl}
+{REF: draw_forum_path.tmpl} /* FRANK */
 {REF: draw_select_opt.tmpl}
 {REF: draw_radio_opt.tmpl}
 {REF: rev_fmt.tmpl}
@@ -133,6 +134,7 @@
 {PAGE: POST_PAGE message posting form}
 {TEMPLATE: header}
 {TEMPLATE: usercp}
+{FUNC: draw_forum_path($frm->cat_id, $frm->name, $frm->id, $msg_subject)}
 <form action="{TEMPLATE: POST_PAGE_lnk3}" method="post" id="post_form" name="post_form" enctype="multipart/form-data" onsubmit="document.forms['post_form'].btn_submit.disabled = true;">
 {DEF: _hs}
 <input type="hidden" name="submitted" value="" />
Re: template question: category name/id and topic name in post.tmpl? [message #160588 is a reply to message #160578] Thu, 01 October 2009 14:39 Go to previous messageGo to next message
qubodup is currently offline  qubodup   Germany
Messages: 24
Registered: February 2008
Karma: 0
Junior Member
add to buddy list
ignore all messages by this user
naudefj wrote on Thu, 01 October 2009 02:26
For example, to dump all variables:
echo "<pre>"; var_dump( get_defined_vars() ); die();


That's pretty cool!
<pre>
  {FUNC: var_dump( get_defined_vars() );}
</pre>


Also thanks for the patch! I want my skin to be compatible with the official FUDforum so I hope it gets included in the next release. Smile
Re: template question: category name/id and topic name in post.tmpl? [message #160598 is a reply to message #160588] Sat, 03 October 2009 14:28 Go to previous messageGo to next message
naudefj is currently offline  naudefj   South Africa
Messages: 3624
Registered: December 2004
Karma: 17
Senior Member
Administrator
Core Developer
remove from buddy list
ignore all messages by this user
Great solution! I've added it to the FAQ at http://cvs.prohost.org/index.php/FAQ
Re: template question: category name/id and topic name in post.tmpl? [message #160599 is a reply to message #160598] Sat, 03 October 2009 14:51 Go to previous messageGo to next message
qubodup is currently offline  qubodup   Germany
Messages: 24
Registered: February 2008
Karma: 0
Junior Member
add to buddy list
ignore all messages by this user
naudefj wrote on Sat, 03 October 2009 14:28
Great solution! I've added it to the FAQ at http://cvs.prohost.org/index.php/FAQ

You should point out that it will show all variables available on *that page only*
Re: template question: category name/id and topic name in post.tmpl? [message #160600 is a reply to message #160599] Sat, 03 October 2009 14:56 Go to previous messageGo to next message
naudefj is currently offline  naudefj   South Africa
Messages: 3624
Registered: December 2004
Karma: 17
Senior Member
Administrator
Core Developer
remove from buddy list
ignore all messages by this user
Will do.

PS: It's a wiki, so you can just hit "edit" to expand the documentation or fix mistakes.
Re: template question: category name/id and topic name in post.tmpl? [message #160602 is a reply to message #160600] Sat, 03 October 2009 15:36 Go to previous message
qubodup is currently offline  qubodup   Germany
Messages: 24
Registered: February 2008
Karma: 0
Junior Member
add to buddy list
ignore all messages by this user
naudefj wrote on Sat, 03 October 2009 14:56
PS: It's a wiki, so you can just hit "edit" to expand the documentation or fix mistakes.

d'oh! Laughing
Quick Reply
Formatting Tools:   
  Switch to threaded view of this topic Create a new topic
Previous Topic: Width of mails on the board
Next Topic: Changing Forum Name
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Mon Oct 23 07:53:07 EDT 2017

Total time taken to generate the page: 0.00778 seconds