Hello,
I would like to use Advanced Forum module (http://groups.drupal.org/node/7123). I have been reading instructions of how to install it and I have to modify "function _phptemplate_variable" as it's said here: http://drupal.org/node/227108
The problem is that I haven't been able to find such a variable and I don't quite understand how it works. What should I do? which file should I edit? how?
thank you
PS: I'm completely new in Drupal's world (I come from phpnuke) and I don't know if that's the correct place to post a question, if not, accept my apologize and tell me where should I address. Thank you.
Comment | File | Size | Author |
---|---|---|---|
#19 | template.php_.txt | 15.93 KB | trevortwining |
Comments
Comment #1
yoroy CreditAttribution: yoroy commentedHi. you should at least post your question to the right issue queue, that of Advanced Forum, not Zen theme.
I can't help you with your actual question but you might have more luck now.
Comment #2
MichelleDid you read the explanation at http://drupal.org/node/207841 ?
Michelle
Comment #3
c-c-m CreditAttribution: c-c-m commentedSure! I red it (in fact I posted a link that I had to follow from that node), but if I follow step #5 and I paste the following code:
at the begining of template.php I get the following errror:
Fatal error: Call to undefined function advanced_profile_forum() in /home/.../template.php on line 3
I paste the content of lines 1-4 here:
I also read the readme file, which is slightly different from that node, but wasn't able to make it work.
The problem is that there's no function "_phptemplate_variables" in Zen's theme, if I make a search, the only instance of _phptemplate_variables is the following one:
* For a sub-theme to add its own variables, instead of _phptemplate_variables,
* use these functions:
* STARTERKIT_preprocess_page(&$vars) to add variables to the page.tpl.php
* STARTERKIT_preprocess_node(&$vars) to add variables to the node.tpl.php
* STARTERKIT_preprocess_comment(&$vars) to add variables to the comment.tpl.php
* STARTERKIT_preprocess_block(&$vars) to add variables to the block.tpl.php
*/
Which I don't understand, since I am new at Drupal's world and I don't understand how does it work. It seems that Zen's theme is slightly different from others' that's why asked about it here instead of asking at Advanced Forum's (answering to yoroy's response)
Any help, please?
Comment #4
MichelleWell, I can see why you got an error. Why did you change the code to "advanced_profile_forum"? There's no such thing. Paste the code on that page I linked you to as is.
As for where to paste it to make it work with subthemes, no idea. For that you'll need to go back to their issue queue so they can explain how to add _phptemplate_variables() to it. Either that or add the call to both the node and comment preprocess functions.
Michelle
Comment #5
c-c-m CreditAttribution: c-c-m commentedMichelle,
I don't understand what am I supposed to do:
as I said, if I make a search on template.php looking for
"function _phptemplate_variables($hook, $vars) {"
I don't get anything as a result. The post you provided says I should get a result. All the text is assuming that I have such a function, which, as I have said, it doesn't exist. (it does exist something close to it, but it's commented).I have pasted the following code (whithout understanding what am I doing):
and I get the following error:
Fatal error: Cannot redeclare _phptemplate_variables() (previously declared in /home/.../sites/all/themes/zen/template.php:143) in /home/.../sites/all/themes/zen/name/template.php on line 14
It seems that as my theme is a Zen's subtheme, theres another function declared before, so I make a search at Zen's root template.php. That's what I get:
As you see I'm not sure where does it end, so I don't know what to put and where. In addition there's no
"function _phptemplate_variables($hook, $vars) {"
butfunction _phptemplate_variables($hook, $vars = array()) {
which is close, but not the same.Could you please help me?
Thank you!
Comment #6
MichelleThe docs you pasted say " For a sub-theme to add its own variables, instead of _phptemplate_variables, use these functions:". Which means you either need to paste it in both the node and comment preprocess functions listed there or you need to find out how you can add _phptemplate_variables to Zen. Beyond that, I don't know. The version of Zen I use is 1.5 years old and doesn't have all this stuff. You need someone familiar with the theme to help you. This isn't specific to advforum. It's a matter of knowing how to add variables to your theme.
Michelle
Comment #7
c-c-m CreditAttribution: c-c-m commentedThanks for trying to help, Michelle, but I don't understand what should I do. I don't feel confident with Drupal's nor Zen's nor php, but thanks anyway. By the way, isn't this the right place to ask for help about Zen's theme? Is there any official support? a better place to ask for help? (sorry, I don't quite understand how does a so huge website works)
Comment #8
JohnAlbinccm & Michelle, it looks like these modules just need to add some variables to the node.tpl.php and comment.tpl.php files.
So, in your sub-themes template.php file, just before the STARTERKIT_preprocess_node() function and just before the STARTERKIT_preprocess_comment(), you need to delete this line:
You should also delete the example code:
$vars['sample_variable'] = t('Lorem ipsum.');
and replace it with the code that advanced_forum and advanced_profile recommend.And, obviously, “STARTERKIT” needs to be replaced with whatever the name of your sub-theme is (as the Zen installation instructions say.)
Let me know if you need me to spell it out more, ccm.
Comment #9
JohnAlbinComment #10
MichelleYeah, that should do it. I don't have any plans to use anything but the node and comment hooks in D5 and in D6 this issue totally goes away, thank the devs.
Michelle
Comment #11
c-c-m CreditAttribution: c-c-m commentedThanks for your reply, JohnAlbin,
I think I found the commented lines, I deleted that line and replaced
with:
wich corresponds to lines 131-135,
but I get the following error:
Fatal error: Call to undefined function advanced_profile_forum() in /home/.../sites/all/themes/zen/themename/template.php on line 133
What did I do wrong?
Comment #12
JohnAlbinNo clue. Michelle?
Comment #13
c-c-m CreditAttribution: c-c-m commentedDon't say that, JohnAlbin! :(
Isn't there any way to implement advanced forums with Zen's theme? Is there any way to contact (and get a response) from their creators: Jeff Robbins with Lullabot?
What should be the process to implement it? maybe I forgot to do something or I did something wrong...
Hope someone can help me with the issue.
Thanks
Comment #14
MichelleSee comment #4.
Michelle
Comment #15
c-c-m CreditAttribution: c-c-m commentedMichelle, I saw it and I replied it at #5. I wasn't able to follow instructions and I provided details about the problems I encountered. Could you be more clear, please?
Thanks
Comment #16
MichelleYes, you corrected it in #5 but then you went and changed it back to "advanced_profile_forum" again. You need to paste exactly what I have there and don't change the function name otherwise you're trying to call a function that doesn't exist.
Michelle
Comment #17
MichelleOk, I need to apologize. I had looked at the explanation page to make sure it was accurate but the mis-copy was actually on the main page and I totally missed it. I just got bit by it when I copied it without looking onto my own site. LOL
I fixed the documentation so you should be all set.
Michelle
Comment #18
c-c-m CreditAttribution: c-c-m commentedMichelle, I got lost. I didn't understand what did you change (sorry, I'm not English speaker, and I have difficulties in understanding English and php ;) )
I re-red the node http://drupal.org/node/207841 again.
I seached for:
function _phptemplate_variables($hook, $vars) {
Since I didn't get any result, I copied:
at the begining of the file
but I got the same error:
Fatal error: Cannot redeclare _phptemplate_variables() (previously declared in /home/.../sites/all/themes/zen/template.php:143) in /home/.../sites/all/themes/zen/plusarquitectura/template.php on line 14
What am I doing wrong?
thanks
Comment #19
trevortwining CreditAttribution: trevortwining commentedc-c-m,
Here is a replacement file for zen/template.php. I tested it locally and it should work on your system. If you've made any other changes to this file, they will be overwritten by this version.
you can find the specific changes on lines 375-381 so you can see what was done/changed.
Comment #20
c-c-m CreditAttribution: c-c-m commentedThank you.
it now works!
Comment #21
c-c-m CreditAttribution: c-c-m commentedWell, it doesn't work completely... Forums are displayed propperly, but when I watch a node and comments, those are displayed as regular forum, not in advanced forum way. What would be the problem? I'm pretty sure of having followed instructions at readme.txt file
Comment #22
MichelleThat's because the call to advforum isn't right. He put it in the 'block' hook so it's not getting called in the right place.
Take that code he added and move it just above this line:
// The following is a deprecated function included for backwards compatibility
That should hopefully fix it.
Michelle
Comment #23
c-c-m CreditAttribution: c-c-m commentedPerfect, Michelle! Now it works.
Comment #24
MichelleThank goodness! :)
Michelle
Comment #25
Anonymous (not verified) CreditAttribution: Anonymous commentedAutomatically closed -- issue fixed for two weeks with no activity.