-
AuthorPosts
-
jfrederiksen Friend
jfrederiksen
- Join date:
- November 2006
- Posts:
- 39
- Downloads:
- 43
- Uploads:
- 7
- Thanks:
- 14
- Thanked:
- 3 times in 1 posts
May 1, 2015 at 8:59 pm #206022Hi,
I would like to add a vertical position between Component and Sidebar (see attached image).
The new position should be same width as Sidebar.How can I do that?
Cheers,
TomC ModeratorTomC
- Join date:
- October 2014
- Posts:
- 14077
- Downloads:
- 58
- Uploads:
- 137
- Thanks:
- 948
- Thanked:
- 3155 times in 2495 posts
May 1, 2015 at 9:10 pm #569153Perhaps the following tutorial will be of assistance –> http://www.joomlart.com/forums/topic/how-to-create-new-module-position-updated/
jfrederiksen Friendjfrederiksen
- Join date:
- November 2006
- Posts:
- 39
- Downloads:
- 43
- Uploads:
- 7
- Thanks:
- 14
- Thanked:
- 3 times in 1 posts
May 4, 2015 at 8:39 am #569292Hi Tom,
Thanks for the link.
I have read it all and watched the videos, but I still can’t get it to work.
My problem is that the new position is put on top or below “Sidebar” – so in the same column.
So far not matter what I have done, I can’t create an extra column between “Component/message” and “Sidebar”.I have attached a screenshot of the layout as it looks now and mainbody.php.
It is all running locally as test, so I can’t provide a link.
What am I missing? Clearly I am missing some code somewhere that creates that extra column.
Cheers,
Saguaros ModeratorSaguaros
- Join date:
- September 2014
- Posts:
- 31405
- Downloads:
- 237
- Uploads:
- 471
- Thanks:
- 845
- Thanked:
- 5346 times in 4964 posts
May 5, 2015 at 8:05 am #569464Hi
At the beginning of this mainbody.php file, you will see this snippet of code:
$sidebar = 'sidebar';
$hasSidebar = $this->countModules ($sidebar);
$mainwidth = $hasSidebar ? ' col-md-9' : ' col-md-12';
Our T3 framework implements Bootstrap which uses the grid system (12 grids). With above configuration, the main content will have 9 grid columns wide and the remained 3 grid columns wide is for the sidebar. That’s why when you add the new sidebar, it appears above the current sidebar.
If you want to add a new sidebar display vertically along with main component block and current sidebar, you will need to customize the mainbody block so that it will have 4 cases:
– mainbody + two sidebars ( 6 grids + 6 grids )
– mainbody + sidebar-1 ( 9 grids + 3 grids )
– mainbody + sidebar-2 ( 9 grids + 3 grids )
– mainbody only (no sidebar) ( 12 grids )For each case, it will require to set the number of grids for each block.
jfrederiksen Friendjfrederiksen
- Join date:
- November 2006
- Posts:
- 39
- Downloads:
- 43
- Uploads:
- 7
- Thanks:
- 14
- Thanked:
- 3 times in 1 posts
May 5, 2015 at 1:01 pm #569518Hi Saguaros,
What you are writing here I also found out this night, but even with your added information I can?t get it to work!
$sidebar = ‘sidebar’;
$sidebarleft = ‘sidebarleft’;
$hasSidebar = $this->countModules ($sidebar);
$hasSidebarleft = $this->countModules ($sidebarleft);
$mainwidth = $hasSidebar ? ‘ col-md-9’ : ‘ col-md-12’;
$mainwidth = $hasSidebarleft ? ‘ col-md-6’ : ‘ col-md-12’;
?>I have added the above code.
Sidebar will always be shown. On all pages, no matter what!
Sidebarleft will only be shown on some pages.With this code, my main page looks as it should. When I click an article, Sidebarleft is gone as I should, BUT my normal Sidebar has now been moved to the bottom of my page, below the article and in the left side.
And how to I define the “- mainbody + two sidebars ( 6 grids + 6 grids )”?
I have tried fx. “$mainwidth = $hasSidebar AND $hasSidebarleft ? ‘ col-md-6’ : ‘ col-md-12’;”Cheers,
Saguaros ModeratorSaguaros
- Join date:
- September 2014
- Posts:
- 31405
- Downloads:
- 237
- Uploads:
- 471
- Thanks:
- 845
- Thanked:
- 5346 times in 4964 posts
May 6, 2015 at 9:44 am #569636You can try with my tweak here:
– Take a backup of ‘mainbody.php’ file
– Download the attached file & unzip into directory: ROOT/templates/ja_teline_v/tpls/blocks/ (the attachment includes ‘mainbody’ folder and ‘mainbody.php’ file)Hope this helps!!!
Saguaros ModeratorSaguaros
- Join date:
- September 2014
- Posts:
- 31405
- Downloads:
- 237
- Uploads:
- 471
- Thanks:
- 845
- Thanked:
- 5346 times in 4964 posts
May 6, 2015 at 9:44 am #734725You can try with my tweak here:
– Take a backup of ‘mainbody.php’ file
– Download the attached file & unzip into directory: ROOT/templates/ja_teline_v/tpls/blocks/ (the attachment includes ‘mainbody’ folder and ‘mainbody.php’ file)Hope this helps!!!
jfrederiksen Friendjfrederiksen
- Join date:
- November 2006
- Posts:
- 39
- Downloads:
- 43
- Uploads:
- 7
- Thanks:
- 14
- Thanked:
- 3 times in 1 posts
May 7, 2015 at 9:22 am #569761Hi,
Thanks for your code.
I could not get it to work, but after looking through it for a while it gave me some tips.
This is how my code in top of mainbody.php looks like now:
$sidebar = ‘sidebar’;
$sidebarleft = ‘sidebarleft’;
$hassidebar = $this->countModules ($sidebar);
$hassidebarleft = $this->countModules ($sidebarleft);if ($hassidebarleft) {
$mainwidth = $hassidebar ? ‘ col-md-6’ : ‘ col-md-12’;
} else {
$mainwidth = $hassidebar ? ‘ col-md-9’ : ‘ col-md-12’;
}Very simple and I only have the mainbody.php file to look after.
Now, to anybody who read this. I am not the best PHP programmer and though I have tested the above code without seeing any problems, please test it yourself before using it!
If anybody see a problem with this code, please let me know.
Cheers,
1 user says Thank You to jfrederiksen for this useful post
AuthorPostsViewing 8 posts - 1 through 8 (of 8 total)This topic contains 8 replies, has 3 voices, and was last updated by Saguaros 9 years, 7 months ago.
We moved to new unified forum. Please post all new support queries in our New Forum
Jump to forum