Closed (fixed)
Project:
Fusion
Version:
6.x-1.0
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
9 Jan 2011 at 11:56 UTC
Updated:
11 Jan 2011 at 09:47 UTC
I'm having trouble with theme override functions and template files for user Login, Register or Password pages.
The problem is, I can not take control over for $title and $tabs varables, which are forced by Fusion core page.tpl.php. My overriden forms display correctly, but there is no $title and $tabs variables present in custom template file (deleted), although they are rendered in form display. Am I missing something?
Comments
Comment #1
j2b commented...follow up (for simplicity - details only on user register form)...
I can not say, if this is relevant, but there are some explanations and my aim is achieved by this:
(1) copied page.tpl.php file from Fusion core theme (as Fusion starter does not have page.tpl.php file) into my custom theme folder
(2) duplicated page.tpl.php in my theme's folder and renamed it according to Drupal Core template suggestions documentation to page-user-register.tpl.php.
From now on I could manage page $title and $tabs variables, by removing them where necessary. Lesson from here and to remind! If you want to override page.tpl.php file with your custom template file, original page.tpl.php file has to be present in the same folder of your custom theme. So according to my initial request, my error was in file naming at this point. user-register.tpl.php has to be page-user-register.tpl.php.
Going forward (May be somebody can comment on this issue part?)...
By implementing template.php file in custom theme and registering via hook_theme() function, plus adding override functions for variables, this information still was not accessible via page-user-register.tpl.php file. In my case I wanted to add text paragraph above user registration form via theme layer. In template.php the following code was:
But unfortunately...
print $introduction;... was not available in page-user-register.tpl.php file. To make this variable available in page-... file, I'd have to set function mytheme_preprocess_page(), where it works, but this would relate to all pages. I wanted to make these variables available only on user registration form. I left function mytheme_preprocess_user_register intact, and modified mytheme_theme function, adding Template line:
After these modifications, I created new file in my theme templates folder called user-register.tpl.php, where I used only statement to print both variables - $introduction and $rendered, which were created by mytheme_preprocess_user_register function. Wrapping in divs and additional styling can be done here. For reference page.tpl.php and page-user-register.tpl.php contain only print statements for $content variable, plus all other page wrappings. No reference to my custom variables at all.
Is this correct, or something is too complicated? Should I use for custom variables for specific form like user register or login separate file?
References (some not answered, but still have some information):
http://drupal.org/node/341628
http://drupal.org/node/190815
http://drupal.org/node/223440
http://joachimwillems.be/node/30
http://fusiondrupalthemes.com/support/theme-developers/subtheming-quicks...
http://fusiondrupalthemes.com/forum/using-fusion/overriding-template-var...
http://fusiondrupalthemes.com/forum/general-drupal-theming-discussion/fo...
http://drupal.org/node/350634
http://www.lullabot.com/articles/modifying-forms-drupal-5-and-6
http://picxelplay.com/blog/theming-drupal-6-registration-login-and-reque...
Comment #2
j2b commentedTo solve my issues in theming level, I'd say, that my knowledge is very small. But all main form tunings I moved to custom module, which appeared to be more easy and not theme dependant. In some cases you have to make judgement, on where exactly to implement form modifications. As to documentation, you have to separate logic and presentation layers (module or theme level accordingly). But in Fusion case, as well as there were similar issues in Zen themes and sub-themes, it is less time consuming to go for some form overrides in custom module, rather digg through theming layer settings and variables. Moving to custom module helped me to run Drupal specific modulations without counting on theme layer overrides. Everything works as expected. Sorry for no comments from community, nor Fusion supporters :(