Welcome to WebmasterWorld Guest from 34.236.145.124

Forum Moderators: open

Message Too Old, No Replies

Loading two template files of same module in two positions

Joomla modules

     
4:29 am on May 16, 2011 (gmt 0)

New User

5+ Year Member

joined:May 16, 2011
posts: 2
votes: 0


Hey..

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,
2:23 pm on May 16, 2011 (gmt 0)

Moderator from US 

WebmasterWorld Administrator travelin_cat is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Feb 28, 2004
posts: 3282
votes: 15


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?
4:52 am on May 17, 2011 (gmt 0)

New User

5+ Year Member

joined:May 16, 2011
posts: 2
votes: 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.