By Nithyanantham on
I have created simple module.i want to display my content and images on the my custom page with my own style sheet.What i want to do now???What are the functions i want to use for template file creation??i am beginner for module development...pls help me..........
Comments
Here is an example.
Here is an example.
1) Register your page with hook_menu():
2) Create your data for your page in your page callback. Set '#theme' to be the theme for your page. Attach your CSS in the #attached property of the render array you return from the callback:
3) Register your theme function in hook_theme():
4) Create your template (my-page.tpl.php)
5) Add any CSS in MODULEFOLDER/css/my_page.css
Contact me to contract me for D7 -> D10/11 migrations.
Thanks for response..Sir i
Thanks for response..Sir i want to change default layout only for my custom page.Now my content and my images displayed content region.i want to remove default region only for that page.i have to create new layout only for my custom page.how can i do sir?pls help me
You need to create a custom
You need to create a custom theme with the layout you want. You can then implement hook_custom_theme() to set your custom theme to be used on the page you want.
Contact me to contract me for D7 -> D10/11 migrations.
Thanks...now i can able
Thanks...now i can able change the theme for custom pages.
Better than examples module content
This is nice, thank you Jaypan. hook_theme and making templates work can be fairly opaque even with the available documentation in my opinion, and this example helps.
One note, I think
print $contents;should beprint render($contents);Thanks again.
-cdmo
You're right, I've altered
You're right, I've altered the post accordingly. Glad it helped.
Contact me to contract me for D7 -> D10/11 migrations.