PDA

View Full Version : Loading two template files of same module in two positions


nijicp
12th May 2011, 11:16 PM
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 position is not assigned at first. And if I press Ctrl+F5 or refreshes, the page will be loaded with the desired output.
Why is this happening? Any Solution??

Thanks in advance,

Olin Coles
15th May 2011, 02:39 PM
Hello: Thanks for posting, but I think this would be a question better suited for the Joomla.org discussion forum or perhaps WebmasterWorld. Good luck!