
Help with subtheme creation
Reported by Peter | August 27th, 2014 @ 03:50 PM | in User issues
I am trying to create a subtheme, think I've followed the guidance, but it doesn't work. I need the subtheme page to have two side-by-side containers with text modules at the top, or a two column text module would be ideal, followed by a normal container with text module.
I am probably missing a trick, I started by trying to create the subtheme with two containers at the top, copy attached. It was located in themes\simpletheme\subthemes and is available when you create a page, but all I see is the default page layout.
I'd be grateful for some guidance.
Thanks.
Comments and changes to this ticket
-
-
dleffler August 28th, 2014 @ 04:49 PM
- Assigned user changed from expNinja to dleffler
First off, you're using the same source/src for ALL the containers which means it will work, BUT they will be identical which is not what you want. @left is used for the sidebar from what I see so maybe you want to have @col-left and @col-right for the two interior containers?
-
Peter August 29th, 2014 @ 07:50 AM
Thank you. After a day of trial and error I am almost there, your input helps explain some of the mystery. The problems arise because it is difficult, sometimes impossible, to find what you are looking for in the documentation. Here's an example, it's where I've got to but I can't find the information to fix this last problem. This is my sub-theme file.
From the screenshot you can see that I have two columns, and it looks like each column has a text module. But as you can see the right hand text is below the left hand text. Much messing about later I think my problem is that both text modules are in the left hand column, and the 'right hand one' is only where it is because of CSS "fleet-txt-right. So I have searched the documentation to find out how I specify a text module in the second column of a two column module without success. My code currently looks like this:
<?php expTheme::module(array("controller"=>"container","action"=>"showall","view"=>"showall","source"=>"@page","scope"=>"sectional"));?>"container","action"=>"showall","view"=>"showall_Two Column","source"=>"@twocol")); ?>"text","action"=>"showall","view"=>"showall","source"=>"@fleet-img-left")); ?>"text","action"=>"showall","view"=>"showall","source"=>"@fleet-txt-right")); ?>
<?php expTheme::main(); ?>
Brief History
<?php expTheme::Module(array("controller"=>"text","action"=>"showall","view"=>"showall","source"=>"@history")); ?>The CSS:
.fleet_container{overflow:hidden;border:#8b0000 2px solid; margin:0 0 10px;padding:10px;} .fleet-txt-right{float:right;display:block;margin:0 0 0 350px;width:330px;} .fleet-img-left{float:left;width:330px;} .fleet-img-left p{margin:0;padding:0;}
Please can you tell me how to create a text module in the right hand column? Thank you.
-
-
dleffler August 29th, 2014 @ 11:07 AM
Ok, a couple of things...not sure if you're asking for help with styling (how to create 2 columns) or how to hard-code modules. Secondly, not sure what you're trying to accomplish that your mockup (two-column container with two text modules) won't already accomplish (that's the way I do it).
None-the-less, some issues in your subtheme template vehicles-tb.php.
- referencing http://docs.exponentcms.org/docs/header-info
- (tip) in expTheme::head() you load the 3 x yui 'reset' sheets, but the newer form would be to comment that out and set 'normalize' to 'true'
- in expTheme::head() you leave the 'css_theme' param blank which equates to 'true' which means the theme will load ALL stylesheets within the /css subfolder of the theme. Therefore, you don't need to load thinkbox/hoverbox since they are already being loaded.
- IF you want the ie_fixes.css sheet to only be optionally loaded, you'll need to place it in another subfolder since it is now automatically loaded ALL the time because it's in the /css subfolder
- referencing http://docs.exponentcms.org/docs/hard-coding-modules
- you can only hard-code top-level containers/modules, e.g., you can hard-code the two column container in the theme/subtheme template, but the two side-by-side text modules would have to be 'added' on the displayed web page. If you want the module configuration menu (chrome), you'll need to add the param of 'chrome'=>true
- general styling - the expTheme::main() call is NOT within a
'div' but simply below the fleet-container div. Might be best to
place it within a div (no class required) because we don't
guarantee everything output into the main container (which isn't
always a module/container will be wrapped in a div.
- same holds true for the Brief History below the main container, might be best wrapped in a div to keep it separate
If you still have some questions, I'm available to assist
- referencing http://docs.exponentcms.org/docs/header-info
-
Peter August 29th, 2014 @ 12:05 PM
Thank you for getting back to me. I'm not after help with styling, but hard coding modules. I started with the index.php file created automatically by Exponent during installation, which I copied into vehicles-tb.php and then tried to customise it. Therefore all of the header info stuff you mention was not created by me. I can try and work through your suggestions later.
If I understand you correctly, I can only hard code a two column container but not hard code a text module under each column. which is what I tried to do. That's OK, I can manage that but I couldn't find anywhere in the documentation where it says I can't do that. I will remove my attempt at adding text modules.
I take your point on adding 'div's - thanks.
-
dleffler August 29th, 2014 @ 06:49 PM
Thanks for the insight, I've updated the doc/help page for hard-coded modules based on your input above.
-
dleffler August 30th, 2014 @ 01:12 AM
- State changed from new to resolved
Seems to have been resolved at this point.
-
Peter August 30th, 2014 @ 09:01 AM
I seem to have one more problem. Now when I use the template I have created, every page is the same. If I change one page it changes the others. Sorry, can you please tell me what I am doing wrong? Thank you so much for your help. (Perhaps some more documentation changes - define how the variables work in exptheme::module).
-
dleffler August 30th, 2014 @ 10:18 AM
- State changed from resolved to open
Ok, the 'scope' defaults to 'global' which means the same content on each page (like a sidebar). Sounds like you want a scope of 'sectional' like the expTheme::main() method does for different content on each page. Extracted from the bottom of this help doc http://docs.exponentcms.org/docs/2.3.0/hard-coding-modules.
There are three scopes for placing hard code modules into a theme.
- global (which is the default), 'global' will show the same
content on all pages. sectional, 'sectional' will show unique
content for each page, so modules/content must be added to each
page individually.
- top-sectional, 'top-sectional' will show the same content for a page and its sub-pages, but unique to that * top level page and its sub-pages.
-
Peter August 31st, 2014 @ 08:07 AM
Thanks, now working. I was unable to find the page that you mention searching for information on building sub-themes. Perhaps some cross-reference from sub-themes to hard coding modules would help. Also looking at that page, it's not clear how to configure the variable parameters - controller, action, view, source. You need to have somewhat more knowledge of how Exponent is built to be able to know what to do here.
Thank you for your help!
-
Peter September 1st, 2014 @ 08:08 AM
Going back to your advice on the header information, and using my test site, I set normalize true and commented out the 3x YUI resets. This lost my theme. I have had to leave the three YUI resets in place to ensure the theme loads.
-
-
-
-
dleffler January 5th, 2016 @ 12:50 PM
- State changed from open to resolved
- Milestone changed from 2.3.8 to User issues
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป
Bug Tracker for Exponent CMS