Members: 10,140
Threads: 38,830
Posts: 159,367
Online: 41

Newest Member: Xoote


Old 22.02.2005, 17:11   #1
rickylau
Baby Mamber
 
Join Date: Feb 2005
Posts: 22
rickylau is on a distinguished road
Default Main body

What is the name of the module position for the main body? Is there any way to get the count on the main body like you can with modules with mosCountModules? I am trying to display the mosMainBody() only if there is anything in the main body, if its possible.
rickylau is offline  
Sponsored Links
Old 22.02.2005, 17:26   #2
august
Mamber
 
august's Avatar
 
Join Date: Aug 2004
Location: Oppland, Norway, Europe
Posts: 99
august is on a distinguished road
Default Re: Main body

The mainbody is no module position, but it is the mainbody..
__________________
August Lilleaas
august is offline  
Old 22.02.2005, 18:14   #3
rickylau
Baby Mamber
 
Join Date: Feb 2005
Posts: 22
rickylau is on a distinguished road
Default Re: Main body

So, is there any way to tell if there is anything inside the mainbody? I know its a weird question, since there should always be something in the mainbody, but I am trying to make a front page with all modules and no main body, so I need to know in the template if the mainbody has anything before calling it.

Thanks
rickylau is offline  
Old 22.02.2005, 20:03   #4
zorkhh
Professional Mamber
 
zorkhh's Avatar
 
Join Date: Apr 2004
Location: Northern Germany
Posts: 713
zorkhh is on a distinguished road
Default Re: Main body

Hello,

check this one:

if ($GLOBALS['_MOS_OPTION']['buffer']) {
// mainbody has content
}

hth

ZorkHH
__________________
News and stories around Joomla! PlanetJoomla.com
For individual Joomla-AddOns visit Joomlaexpert.com
zorkhh is offline  
Old 22.02.2005, 22:07   #5
rickylau
Baby Mamber
 
Join Date: Feb 2005
Posts: 22
rickylau is on a distinguished road
Default Re: Main body

I tried echoing $GLOBALS['_MOS_OPTION']['buffer'] and I get the 'There are no items to display' string, so the code

if($GLOBALS['_MOS_OPTION']['buffer'])

does not return false even if there is no item in the mainbody, so is there another way to find out if body is empty? Or just point me to where the message 'There are no items to display' is set on $GLOBALS['_MOS_OPTION']['buffer'].

Thanks
rickylau is offline  
Old 22.02.2005, 22:14   #6
zorkhh
Professional Mamber
 
zorkhh's Avatar
 
Join Date: Apr 2004
Location: Northern Germany
Posts: 713
zorkhh is on a distinguished road
Default Re: Main body

Hi,

$GLOBALS['_MOS_OPTION']['buffer'] is the variable, where the maincontent is "in". That's what you wanted to know... I don't know, what you mean, when you say "anything inside the mainbody".

So, what is it, you want to check for?!?

ZorkHH
__________________
News and stories around Joomla! PlanetJoomla.com
For individual Joomla-AddOns visit Joomlaexpert.com
zorkhh is offline  
Old 22.02.2005, 22:50   #7
rickylau
Baby Mamber
 
Join Date: Feb 2005
Posts: 22
rickylau is on a distinguished road
Default Re: Main body

I think I figured it out. I just created I new global variable if the main body is empty. Basically its hacked to get it to work.

To zorkhh, the thing I was trying to do was to determine if there is content when I call the mosMainBody() function, instead of getting the output 'There are no items to display' becuase I did not put anything in the front page. So now I only call mosMainBody() when there are items to display.

Thanks for the help though.
rickylau is offline  
Old 03.04.2005, 00:57   #8
duforudesign
Guest
 
Posts: n/a
RedCross Re: Main body

Quote:
Originally Posted by rickylau
I think I figured it out. I just created I new global variable if the main body is empty. Basically its hacked to get it to work.

To zorkhh, the thing I was trying to do was to determine if there is content when I call the mosMainBody() function, instead of getting the output 'There are no items to display' becuase I did not put anything in the front page. So now I only call mosMainBody() when there are items to display.

Thanks for the help though.
I use the following dirty hack:

Code:
if (!substr_count($GLOBALS['_MOS_OPTION']['buffer'],"no items "))
{
	mosMainBody(); 
} else {
	mosLoadModules("user5"); 
}
 
Old 22.08.2005, 21:47   #9
enandret
Baby Mamber
 
Join Date: Jul 2005
Posts: 10
enandret is on a distinguished road
Default Re: Main body

Sorry if I write to you but I have your same problem!!

I use mambo 4.5.2 and I would like not visualize the mainbody when its is empty or in my case is the same doesn't visualize mainbody in homepage .

How can I do???

Thanks for all suggestion.

Enzo
enandret is offline  
Old 18.05.2006, 17:37   #10
greensweater
Guest
 
Posts: n/a
Default Re: Main body

Late follow up, but I found this page looking for the solution so I'm posting this...

To hide this on the front page (but keep it inside on empty blog pages) put this in your template where the mosMainBody() function is called (I included a DIV for styling):

Code:
<?php if(!($option == com_frontpage && ereg(_EMPTY_BLOG,$GLOBALS['_MOS_OPTION']['buffer']) !== FALSE )) { ?>
<div class='mainbody'>
  <?php mosMainBody(); ?>
</div>
<?php } ?>
As long as your body doesn't contain the exact phrase "There are no items to display" or whatever you set it to in your language file, this will work.
 
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Main Menu Hack... Anyone have an idea about this? Thanks! meek Module 'How Do I' Questions 1 27.02.2005 00:41
Probleme mit zOOm Media Gallery Suby Komponenten 2 18.01.2005 19:27
3 Level deep Main menu thomas9 Mambo 4.5.1 'How Do I' Questions 4 14.12.2004 23:33
warning, main body errors. pls help. skope Module 'How Do I' Questions 2 26.10.2004 02:04
linking direct from main menu to main body mikeh1980 Mambo 4.5 'How Do I' Questions 7 17.06.2004 15:52


All times are GMT +2. The time now is 12:31.

Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
A vBSkinworks Design
© Copyright 2004-2008 by Arthur Konze Webdesign.