Joomla Layout Question

I am quite new to Joomla - so please be gental and provide a discription to any answer you provide so I may gain a deeper understanding.

The question I have is:

I have my main menu in the position of user3, but I want the articals to be position "left" this way the menu itself will be placed where I want it and the articals to be placed where I want them. How can I go about doing this? I have a site up for reference:

www.testingtesting1.info

If you click on any of the menu options (besides home) along the right side I want the artical (the menu item points to) to show up on the left side. Much the same way the home button works, where if you click home the flash and popular/latest options are displayed.
LVL 1
MorganAsked:
Who is Participating?
 
joomla_phpCommented:
The articles will always go in the "component" area. The component area is a specific area designed to hold the main body content. That content can be articles, a calendar, a form to fill in. So the lesson here is that components go in the "main body" area where the Joomla PHP call to the component is rendered.

On that site's home page the flash content is in position user1. There actually isn't any component content being rendered. It looks (guess) as if there are no articles assigned to the home page, nor are there any articles assigned to the service, etc. menus.

If you post the contents of /templates/TotalEEYouGeneral/index.php I can give you more info.
0
 
pekaboCommented:
Just change your main menu to position right instead of user3
deactivate all modules that has the position left or change them to a new position
result:
All artikels are left and the main menu are right
0
 
MorganAuthor Commented:
Joomla php:

With the info you provided I think then I am doing something wrong in my write up in the index.php file. I have provided the code within the index.php file.

I can get the information to display if i change the second if statement to user3, but then the "artical boarder" is displayed on the home page with nothing contained within it. With this change if you click the service button the artical displays where I want it to.

Thank you for the insight regarding the component - that does clear things up a bit.
<?php defined( '_JEXEC' ) or die( 'Restricted access' ); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $this->language; ?>" lang="<?php echo $this->language; ?>" >

<head>
<jdoc:include type="head" />
<link rel="stylesheet" href="/templates/TotalEEYouGeneral/css/template.css" type="text/css" />
<link rel="stylesheet" href="/templates/TotalEEYouGeneral/css/menu.css" type="text/css" />
<script language="javascript">AC_FL_RunContent = 0;</script>
<script src="/templates/TotalEEYouGeneral/script/AC_RunActiveContent.js" language="javascript"></script>
</head>

<body id="page_bg">
<div id="topheader">
	<div id="search">
		<jdoc:include type="modules" name="user4" />
    <!-- END SEARCH --></div>
<!-- END TOPHEADER --></div>
	<div class="contentarea">
    	<div id="splatter2"><!-- END SPLATTER2 --></div>
    	<div id="header">
        	<div id="logo"><!-- END LOGO --></div>
        <!-- END HEADER --></div> 
        <?php if($this->countModules('user1')) : ?>
        <div class="ltarea">
        	<div id="flashmenu">
				<jdoc:include type="modules" name="user1" />
       		<!-- END FLASHMENU --></div>
            <div id="popular-menu">
            	<div class="lp-menu">
            		<div class="lp-footer">
            			<div class="lp-header">
                    		<h1>Popular</h1>
                   		<!-- END LP-HEADER --></div>
                		<div class="lp-contents">
                        <!-- END LP-CARTCONTENTS --></div>                                           
                    <!-- END LP-FOOTER --></div>
            	<!-- END LP-MENU --></div>
           	<!-- END POPULAR --></div>
            <div id="latest-menu">
            	<div class="lp-menu">
            		<div class="lp-footer">
            			<div class="lp-header">
                    		<h1>Latest</h1>
                   		<!-- END LP-HEADER --></div>
                		<div class="lp-contents">
                        <!-- END LP-CARTCONTENTS --></div>                                           
                    <!-- END LP-FOOTER --></div>
            	<!-- END LP-MENU --></div>
           	<!-- END POPULAR --></div>
       	<!-- END LTAREA --></div>
        <?php endif; ?>
        <?php if($this->countModules('left')) : ?>
        <div class="ltarea">
            <div id="artical-layout">
               	<div class="artical">
            		<div class="artical-footer">
                       	<div class="artical-header">
                           
                        <!-- END ARTICAL-HEADER --></div>
                        <div class="artical-contents">
                       		<jdoc:include type="modules" name="left" />
                       		<jdoc:include type="component" />
               				<jdoc:include type="message" />
                        <!-- END ARTICAL-CONTENTS --></div>
                    <!-- END ARTICAL-FOOTER --></div>
                <!-- END ARTICAL --></div>
            <!-- END ARTICAL-LAYOUT --></div>                    	
        <!-- END LTAREA --></div>
        <?php endif; ?>
        <div class="rtarea">
        	<div id="mainmenu">
            	<jdoc:include type="modules" name="user3" />
			<!-- END MAINMENU --></div>
            <jdoc:include type="modules" name="right" />
        <!-- END RTAREA --></div>
    <!-- END CONTENTAREA --></div>
 
<div id="bottomfooter">
	<div class="footer" style="color:#fff">
    Hello!
	<!-- END FOOTER --></div>
<!-- END BOTTOMFOOTER --></div>
<div class="footer">
<?php echo "<p>Copyright &copy 2007-".date('Y')." Total Electronic Entertainment. All Rights Reserved.</p>"; ?>
<!-- END FOOTER --></div>
<!-- END FOOTER --></div>
</body>
</html>

Open in new window

0
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

 
joomla_phpCommented:
That's looking good- are the right hand menus hooked to articles? I think that's your next step. You can create a placeholder menu that is not published. Make a menu item for services, portfolio.... then use the links that this menu creates for you to populate the blue menu art on the right side of the pages.
0
 
MorganAuthor Commented:
Yes, the menus are "hooked" to some mocked up articles. But with the code i pasted above the articals don't show. However, if i make this change:

 <?php if($this->countModules('left')) : ?>

CHANGED TO:

 <?php if($this->countModules('user3')) : ?>

The articals show, but the home page is all out of wack. The main menu ends up moving down becoming parrellal with the artical-layout (while still in the rtarea), and the artical layout shows on the home page at the very bottom (in the ltarea), which I don't want showing on the home page. I only want the artical-layout to show when an artical is being displayed but I want the main menu to be displayed on all "pages". Ergo, going back to the original question How can I have the articals display where I want them? I made the assumption (with my limited understanding) the articals would be displayed  within the "left" position if the component was there as you mentioned earlier.

I feel I should mention also, before adding the artical-layout code, everything worked. I added this code because I felt without it the website was too open, allowing the user's eye to wonder and not focus on the content being displayed. Once I added this code the articals would no longer appear. I have thought of moving this code into each individual artical I write (copy and paste) but I think that defeats the purpose of trying to seperate content from layout.
0
 
MorganAuthor Commented:
To give you an idea of the issue with the change:

<?php if($this->countModules('left')) : ?>

CHANGED TO:

 <?php if($this->countModules('user3')) : ?>

I have teh site live. www.testingtesting1.info

if you think it will help finding out why this si not working I can remove the artical-layout code to demonstrate the articals where showing prior to the addtion of the artical-layout code.
0
 
joomla_phpCommented:
I didn't see that before. This statement
              <jdoc:include type="component" />

should not be dependent on a conditional test. It should dump the component regardless of which modules are also in play.
0
 
MorganAuthor Commented:
I don't understand. Where than should the component go? And how do I get the desired result I am wanting?
0
 
joomla_phpCommented:
I'm going to backup a step before I answer.
Why are you building a template from scratch?
There are tons of templates out there that will not require you to understand this level of detail.
0
 
MorganAuthor Commented:
It's part of my personality. If I want to do something, with something, I want to know how it works - I do it this way so I gain one thing and one thing only: knowledge.

I feel I have an ok grasp of it so far. I am curious on why it worked before adding the artical-layout and the additionaly conditional statement: <?php if($this->countModules('left')) : ?>. Before I only had the one conidtional statement:  <?php if($this->countModules('user1')) : ?>.

I think I knwo why it worked: The home page has no "artical". It's the frontpage of the site and therefore its an entity all in itself, ergo being able to assign modules and articals to the frontpage. As the frontpage has no artical and the component (the container for the content (articals)) is blank, nothing showed on the frontpage. But when a user clicks on one of the menu buttons, such as Services, an artical (in this case Services) is retrieved from the database and the compenent is "filled", the frontpage is then replaced by the artical.

When I added the artical-layout code I am now displaying something and thus it shows up on the homepage. And this is where my understanding is a little fuzzy, why is it that when the original code was in place thigns worked, but when I added the artical-layout code eveything does not work.

Again do you think I should just add the artial-layout code to each individual artical that I write? I am still using a CSS file to contral layout so it should not be to big of a deal ot make changes, though if I decide a year down the road I want to change the howl lay out I will need to go to each artical and make changes. That does not sound all that fun.
0
 
joomla_phpCommented:
I was testing your site to answer and I see that you did it!

Re: knowledge -- me too, that's exactly how I work. Take it apart and build another one.

When there's a conditional left, conditional user1, and both have assignments, that's as good in rendering as if there had been no conditionals at all, i.e., the condition was met so the component rendered. It would depend on whether anything had been assigned to left or user1 before, and now. But components should never be conditioned on module content.

You can assign an article to the home page. You set the radio button near the "published" radio in the article. Any article assigned to the home page should print in the component area.
"When I added the artical-layout code I am now  displaying something and thus it shows up on the homepage. And this is  where my understanding is a little fuzzy, why is it that when the  original code was in place thigns worked, but when I added the  artical-layout code eveything does not work." --
I'm sorry but I didn't follow the changes with enough understanding to answer this one.

"Again do you think I  should just add the artial-layout code to each individual artical that I  write?"
I don't understand the question.

"Article layout code" -- what does that mean?

At any rate -- when you assign an article to a menu or to the "front page" you are telling the content component to get the article and render it in the content area. Article content should always be an abstraction -- never requiring specific code to make any article behave in a specific way. This is the separation of logic and layout, and it's an important concept to make your code extensible down the road.


0
 
MorganAuthor Commented:
Joomla php:

I think we are failing in communicating. You said, "I was testing your site to answer and I see that you did it!"

I am still having the same issue. Yes the artical's are now appearing, but the home page is not the way I want it. I have attached a screen shot of the home page with written notes. As of now the artical boarder is showing and I don't want it to be seen as there is no artical on the frontpage (home page). The main menu is at the bottom of the page, it should be at the top of the page directly underneath the header.

To answer you question about the artical layout code. The artical layout code is the boarder I want around the articals, it's a blue boarder. The code for this boarder is below. If you click on Services you will see the boarder around the artical. And as mentioned above the artical boarder is showign on the home page, and I don't want it showing on the home page.
<div id="artical-layout">
               	<div class="artical">
            		<div class="artical-footer">
                       	<div class="artical-header">
                           
                        <!-- END ARTICAL-HEADER --></div>
                        <div class="artical-contents">
                       		<jdoc:include type="modules" name="left" />
                       		<jdoc:include type="component" />
               				<jdoc:include type="message" />
                        <!-- END ARTICAL-CONTENTS --></div>
                    <!-- END ARTICAL-FOOTER --></div>
                <!-- END ARTICAL --></div>
            <!-- END ARTICAL-LAYOUT --></div>    

Open in new window

home-page.gif
0
 
JoomstrupCommented:
First you need to back up a bit redo your template.

When you are beginning designing j! templates, it might been good for you to design a regular html page.
So you get the formatting right, so you don't get caught up in having to debug formatting/design and php at the same time.

You are using <?php if($this->countModules('left')) : ?> this is ONLY used to check if you have any modules assigned to this position. NOT to actually show the module. You use this check to see if there are any modules to be rendered else you can have the module position collapsed. E.g. you have a left column you might only want to have that to show where there actual IS information to be shown and not have an empty column when no modules are assigned.
You show a modules using this code <jdoc:include type="module" name="submenu" style="xhtml" />


so the right code is
<?php if($this->countModules('left'));
<jdoc:include type="module" name="left" style="xhtml" />
 ?>

the style can be different depending on how you want the module to look.

for more information see http://docs.joomla.org/Jdoc_statements

ALSO remember that the name="left" which is the name of the module position has to be in your templateDetails.xml file for you to be able to choose that position in the J! module manager.
0
 
joomla_phpCommented:
Conditionalize all Article CSS around NOT being on the front page.
This means you will never display any components on the front page.

The problem is that the CSS is being invoked outside of whether there's anything to print.

http://docs.joomla.org/How_to_determine_if_the_user_is_viewing_the_front_pagehttp://docs.joomla.org/How_to_determine_if_the_user_is_viewing_the_front_page
0
 
MorganAuthor Commented:
Joomstrup:

Thank you for the insight and the link on Jdoc statements. As for redoing the template I dont' beleive it is necassary. The HTML and CSS si providing the layout I want - the issue I am having is pluging in the "right" modules and usign the component correctly. I could strip all the joomla code and replace it with my content and have afunctioning site. But, I want to rigth and be able to maintain articals, ergo wanting to use joomla.

I'm am going to dig further into the Jdoc statements to learn more about them. Also than you for clarifying the use of <?php if($this->countModules('left')) : ?>.

Joomla php:

I am going to look into the link you provided in order to NOT show CSS on the front page.

Both:

It is the weekend, I will begin working on this again on monday.
0
 
MorganAuthor Commented:
OK, I have made changes. Some of the coding was a bit off :) I have moved the component out of the conditional statement. I have removed the statement <?php if($this->countModules('left')) : ?>. Going back and reviewing the backend I didn't having any modules assigned to the position left as of right now. The front page is how I want it, along with the main menu. The menu links are assigned their articals and clicking on them will display the artical. However, I am having a hard time figuring out how to place my artical boarder around the articals, while keeping with the idea the component is independent from a conditional statement.

Joomla php:

I'v reviewed the link you provided and I think it may work, but by using it how can I apply the border around the artical within using the current CSS code I have?

Joomstrup:

Reviewing your link, THANKS this will help quite a bit as I refine the front page. I do have a question, if I wanted to render (show) a specific module named Flash Menu that was assigned the user1 position I would use this code:

<jdoc:include type="module" name="Flash Menu" />

or would I have to use the module class suffix for the name? in this case:

<jdoc:include type="module" name="flashmenu" />
 
0
 
MorganAuthor Commented:
I forgot to provide my changed code.
<div class="ltarea">
        	<jdoc:include type="component" />
            <jdoc:include type="message" />
            <?php if($this->countModules('user1')) : ?>
                <div id="flashmenu">
                    <jdoc:include type="modules" name="user1" />
                <!-- END FLASHMENU --></div>
                <div id="popular-menu">
                    <div class="lp-menu">
                        <div class="lp-footer">
                            <div class="lp-header">
                                <h1>Popular</h1>
                            <!-- END LP-HEADER --></div>
                            <div class="lp-contents">
                            <!-- END LP-CARTCONTENTS --></div>                                           
                        <!-- END LP-FOOTER --></div>
                    <!-- END LP-MENU --></div>
                <!-- END POPULAR --></div>
                <div id="latest-menu">
                    <div class="lp-menu">
                        <div class="lp-footer">
                            <div class="lp-header">
                                <h1>Latest</h1>
                            <!-- END LP-HEADER --></div>
                            <div class="lp-contents">
                            <!-- END LP-CARTCONTENTS --></div>                                           
                        <!-- END LP-FOOTER --></div>
                    <!-- END LP-MENU --></div>
                <!-- END POPULAR --></div>
            <?php endif; ?>
        <!-- END LTAREA --></div>
        <div class="rtarea">
        	<div id="mainmenu">
            	<jdoc:include type="modules" name="user3" />
			<!-- END MAINMENU --></div>
            <jdoc:include type="modules" name="right" />
        <!-- END RTAREA --></div>
    <!-- END CONTENTAREA --></div>

Open in new window

0
 
JoomstrupCommented:
<jdoc:include type="module" name="flashmenu" />

the name is your moduleposition name and is only used for position and there should be no spaces.
you should also add the chrome style="xhtml"> so your code is
<jdoc:include type="module" name="flashmenu" style="xhtml" />
0
 
MorganAuthor Commented:
Joomstrup:

Sweet thanks. Would you recommend creating new positions to help give clarity or use the predefined ones?
0
 
MorganAuthor Commented:
ALRIGHT!!

Finally got the border to go around my articals. :) I used the code from the link that joomla php gave. I do feel however there would be an eaiser way to go about doing it though. Would either one of you care to take a look at the code and let me know if it is adequate or recomend another route.
<div class="ltarea">
        	<?php $menu = & JSite::getMenu();
			if ($menu->getActive() != $menu->getDefault()) {
        		echo '<div id="artical-layout">
               		   <div class="artical">
            			<div class="artical-footer">
                       		<div class="artical-header">                           
                        	<!-- END ARTICAL-HEADER --></div>
                        	<div class="artical-contents"> ';
			}?>

        	<jdoc:include type="component" />
            <jdoc:include type="message" />
            
            <?php $menu = & JSite::getMenu(); 
			if ($menu->getActive() != $menu->getDefault()) {
        					echo '<!-- END ARTICAL-CONTENTS --></div>
                    	<!-- END ARTICAL-FOOTER --></div>
                	<!-- END ARTICAL --></div>
            	<!-- END ARTICAL-LAYOUT --></div>';  
			}?>

Open in new window

0
 
JoomstrupCommented:
What do you want to achieve using your

<?php $menu = & JSite::getMenu();

?

You should style everything just using in your css

If you want special formatting of a page/menu item you can do you using the Page Class Suffix in Parameter (System) section of the individual menu item in the Menu manager.

0
 
joomla_phpCommented:
Joomstrup - the issue is that the home page should show no components. The css for the home page was displaying regardless of whether a component displayed. So the css is now displaying conditioned upon there being a component to decorate.

neonate - the component should be called inside the conditional, right now it's below the conditional:


<div class="ltarea">
<!-- anything that goes on both home and on-home pages is here -->
<jdoc:include type="message" />
<?php
$menu = & JSite::getMenu();
// only non-home-page-component output here
if ($menu->getActive() != $menu->getDefault()) {
    ?>
    <div id="article">
        <jdoc:include type="component" />
    </div>
}?>
<!-- anything that goes on both home and on-home pages is here -->
</div><!-- end ltarea -->
0
 
JoomstrupCommented:
Ahh I see.

many ways to do this :-)

could also be done in htaccess

or using the Joomla template assignmet

and some other ways, but those would not be so smart.
0
 
MorganAuthor Commented:
Joomla php:

I put the component in between because I was going with your earlier statement:

"I didn't see that before. This statement
             <jdoc:include type="component" />
should not be dependent on a conditional test. It should dump the component regardless of which modules are also in play."

So I was trying to place the component as an independent :).

I'v changed the code to your recommendation (a lot cleaner now) and it is still working.
Could you please explain what this line of code is doing. I mean I understand it is assiging menu the value of JSite::getMenu() but what menu. Is this the same concept that the menu a page?

joomstrup:

I understand I should be styling everything with CSS - seperating content from layout :), but from what you are saying that I can apply my artical boarder without the conditional statement? Again the artical boarder should only be visible when an artical is being viewed.


<div class="ltarea">
        	<jdoc:include type="message" />
        	<?php $menu = & JSite::getMenu();
			if ($menu->getActive() != $menu->getDefault()) {
        		echo '<div id="artical-layout">
               		   <div class="artical">
            			<div class="artical-footer">
                       		<div class="artical-header">                           
                        	<!-- END ARTICAL-HEADER --></div>
                        	<div class="artical-contents"> 
							<jdoc:include type="component" />
							<!-- END ARTICAL-CONTENTS --></div>
                    	<!-- END ARTICAL-FOOTER --></div>
                	<!-- END ARTICAL --></div>
            	<!-- END ARTICAL-LAYOUT --></div>';  
			}?>

Open in new window

0
 
joomla_phpCommented:
.htaccess to prevent a component from displaying on the home page...? But I like your template idea, that is a good way to go I think.

neonate - sorry for the confusion. The component should not be dependent on a module conditional. It's ok for it to be dependent on a page conditional.
0
 
JoomstrupCommented:
in htaccess you could setup a redirect for a index_alt.php which would be a copy of the index.php but without  jdoc component part of course.

If you add a check for referrer to this you can make people coming from anywhere but an internal link going to an alternative "frontpage", but once one the site your home button will take the users to the "real" front page. Like of you want a splash page or something.

sorry for taking this off topic, but I just wanted to throw this in as it might be handy
0
 
MorganAuthor Commented:
hmm, how do you go about what I am wanting through the template idea?
0
 
joomla_phpCommented:
That's very cool Joomstrup -
neonate - make a second template, assign it to the home page, assign the original template to all other pages.
The only thing is that it takes you off your learning curve and spreads it a little thin. I'd stay on the path you're on.
0
 
MorganAuthor Commented:
Yeah I think I will stay with one template for now. Though as I progroess in knowledge I will look further into it.
0
 
MorganAuthor Commented:
Thank YOU!
0
 
MorganAuthor Commented:
I provided the joomla php the majority of the points as he/she provided a more direct answer. I provided joomstrut points on the account he/sh did provide insight and other helpful information.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.