Closed (won't fix)
Project:
Views (for Drupal 7)
Version:
5.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Reporter:
Created:
29 Jan 2008 at 20:50 UTC
Updated:
9 May 2008 at 06:54 UTC
First off, I love the theme wizard. Yay, wizard!
But I'm having some trouble with the code that it generates. Specifically:
_phptemplate_callback('views-list-VIEWNAME', $vars);
Because the $hook (views-list-VIEWNAME) for _phptemplate_callback() has a dash in it instead of an underscore, the hook function is not possible to call (_phptemplate_HOOK()) because, of course, you can’t have a dash in a function name. So the _phptemplate_default() function is always called.
The fix for this is pretty simple. Just change the above code to:
_phptemplate_callback('views_list_VIEWNAME', $vars, array('views-list-VIEWNAME'));
The attached patch applies to both DRUPAL-5 and HEAD.
| Comment | File | Size | Author |
|---|---|---|---|
| theme-wizard-callback.patch | 1.59 KB | johnalbin |
Comments
Comment #1
kdebaas commentedI applied the patch and used the Theme Wizard to generate the code for my template.php. Works as advertised. Thanks John!
Comment #2
johnalbinSince it works for Klaas (and for me)…
Comment #3
s.daniel commentedThanks for the patch.
Works for me.
Also see Zen issue related to this one: http://drupal.org/node/196181
Comment #4
johnalbinEarl, do we want to change the template suggestions from views-list-VIEW_NAME (with an underscore) to views-list-VIEW-NAME (with all dashes)? Drupal naming convention would indicate views-list-VIEW-NAME is preferred, but I'll leave the decision to you. If you want to use all dashes, I can roll a new patch.
The nice thing is we can make these change without breaking any previous code, since the old code has been copied and pasted into the template.php and will continue to work as before.
Comment #5
nimzie commentedI had tried this initially. It failed. Then I found this article.
I rolled the patch in to my .module file.
Then, I deleted my views-list-registrants.tpl.php, views-list-registrants.css files I had previously generated before patching.
I then cleaned the function out of template.php and ran the theme wizard again.
My view is called registrants.
My URL is view-registration.
I re-added the code to template.php, then re-created the views-list-registrants.tpl.php file as well as the views-list-registrants.css file with the proper code snippets within. They all reside in the theme directory with the rest of my theme files.
It's still not hooking in to the function as I would have hoped... I've tried to echo some code in the function in template.php as well as changing text bits in my .tpl.php file. Nothing is hooking in.
This is one of my first times doing things like this in Drupal, so there's a chance I did something incorrectly, but I double / triple checked the patch, the new file names as well as the template.php code (to see if it would echo me something) and it's not. If I have a syntax error in template.php, it's caught and drupal lets me know.
function phptemplate_views_view_list_registrants($view, $nodes, $type)
is what the function is initially called.
I am going to my regular URL for the view which I set in the view editor as view-registrants (www.mysite.com/view-registrants). Could that be the problem? That I'm going to the regular view.url when I should be going to something else?
Thanks for your assistance.
Adam
p.s. also, what is the best forum for stuff like this - I am not sure if I'm not asking questions well (have read FAQ etc) and am only seldom receiving responses.
Comment #6
johnalbinAdam, this discussion is a "bug report" for a specific bug. If you can't get Views Theme Wizard working before applying this patch, you are having a separate issue and should submit a "support request".
Getting support requests answered can be tricky. If the support issue is related to a specific module, I would recommend posting an issue to that module's issue queue AND posting an issue to Drupal's forums. A module’s issue queue is only looked at when the module maintainer (or interested individuals) have time to go through that (and they are all volunteers), so it may take a while.
As far as I know, the Zen theme is the only theme that requires this patch. So if you are using the Zen theme, you can post your support request over there and I'll take a look at it.
Comment #7
nimzie commentedSimply switching the view to list-view in the view editor fixed. I am not sure where I missed this step.
Thank you for your direction. I've been working with this tool for a month or so and am totally blown away. What a great community and fantastic tool-set.
Comment #8
johnalbinBumping this to the top of the issue queue. 4 weeks with no love. :-(
;-)
Comment #9
johnalbinThis patch applies cleanly to Views 2. After it goes into 2, we can get it into 5.x-1.x.
Comment #10
johnalbinNevermind. Appearantly,
even though the views_theme_wizard.module is still in HEAD, its not going to be a part of Views 2.edit: I really hate CVS sometimes. views_theme_wizard.module is NOT in HEAD, CVS just got confused when I had a patched DRUPAL-5 version of the module and ran “cvs up -A” on the directory.
Comment #11
johnalbin_phptemplate_callback() is fubar. Talked to Merlin on IRC tonight about this issue.
Its simpler to just keep the Zen work-around well documented (over at http://drupal.org/node/220111) and we'll leave Views 1.x be. Fortunately, none of this is an issue in Drupal 6 and Views 2. yay!
Comment #12
holeepassion commentedwhere is the theme wizard exactly and could it be used to modify ubercart theme, like garland ???
i just want simple modification ?
thanks