homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / Content Management
Forum Library, Charter, Moderators: ergophobe

Content Management Forum

Loading two template files of same module in two positions
Joomla modules

Msg#: 4312883 posted 4:29 am on May 16, 2011 (gmt 0)


I am working on a new project and I am using Joomla version 1.5.22.
I need to display one horizontal search form in the middle of home page and the same search form in vertical style in all other pages but in left position.
So what I did is, I created two template files one for horizontal search(horizontal.php) and other for vertical search (vertical.php) and in mod_modulename.php I tried to load the respective modules based on a certain condition and changed the position left or middle according to it. The positions are changed in the database to get effected in the admin panel.

if(condition) {
modModulenameHelper::changeToVertical($position); //changed the position in database to left
require( JModuleHelper::getLayoutPath( 'mod_modulename', 'vertical'));
else {
modModulenameHelper::changeToHorizontal($position); //changed the position in database to middle
require( JModuleHelper::getLayoutPath( 'mod_modulename', 'horizontal'));

But I am not getting the correct output. It is loading the respective modules based on the condition. But the template is not assigned at the desired position on loading the module at first.

Why is this happening? Any Solution?

Thanks in advance,


travelin cat

WebmasterWorld Administrator travelin_cat us a WebmasterWorld Top Contributor of All Time 10+ Year Member

Msg#: 4312883 posted 2:23 pm on May 16, 2011 (gmt 0)

Thanks for visiting WebmasterWorld nijicp.

I'm Not sure what you mean by "I created two template files" do you mean you created two modules?

Did you create the template you are using yourself or did you purchase one?


Msg#: 4312883 posted 4:52 am on May 17, 2011 (gmt 0)

No. Creating two template files means inside a module i have created two files in tmpl folder with same content with different CSS stylings. ie, one in horizontal layout and other in vertical layout.

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / Content Management
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved