Need extra help with your Joomla site? Consider paid Joomla support by the developer of Chameleon and MetaMod.
myBlog Php does not work?
myBlog Php does not work?
Hello,
I would like to show a slideshow only on the myBlog homepage.
I have this PHP code from Metamode Docs:
Code:
if ( $option == "com_myblog" and JRequest::getVar('task') == '' ) return 37;
but with this PHP code, the slideshow will not display.
Code:
Debug:
if (
$option == 'com_content'
and $Itemid == '316'
and JRequest::getVar('task') == 'view' /*!*/
) return XXX;
$option: com_content
$view:
$id:
$Itemid: 316
$timezone: default
$language: de-de
$language_code: de
$language_region: de
Eingebundene Module:
The php code on debug works, but the module is also displayed in the articel full view.
Metamod 2.3
Regards,
Martin
26-Jul-10 23:06:37
Re: myBlog Php does not work?
Hi Martin,
I just re-installed my copy of MyBlog to try to replicate your setup. So far I haven't managed to replicate it.
On the MyBlog front page (i.e. when I make a menu item to MyBlog), I get a URL like this: index.php?option=com_myblog&Itemid=153
... and the MetaMod Advanced Debug gives me:
if (
$option == 'com_myblog'
and $Itemid == '153'
) return XXX; /* replace XXX with the module ID or position to display */
MetaMod debug info:
$option: com_myblog
$view:
$id:
$Itemid: 153
Can you confirm that the advanced debug output that you gave was actually from the front page of the blog? i.e. a menu item pointing to MyBlog?
Cheers,
Stephen
Re: myBlog Php does not work?
Hi Martin,
it looks like your installation of MyBlog works *very* differently to mine! (thanks for the login - but it only confirmed what you said already).
Can you tell me what version of MyBlog you have installed?
I just installed 3.0.332 on a fresh joomla installation and I can't get it to show $option as com_content, only as com_myblog.
Cheers,
Stephen
Re: myBlog Php does not work?
hmmmm. Do you have any interesting/different system plugins installed? If you want to PM me your admin login details I could check through the rest of the setup.
Cheers,
Stephen
Re: myBlog Php does not work?
Just looking at the code for myblog. In libraries/plugins.php I see the following code:
JRequest::setVar( 'task' , 'view' , 'GET' );
JRequest::setVar( 'option' , 'com_content' , 'GET' );
This is a bit nasty really. This overrides the URL parameters that you'd normally get with JRequest::getVar("option") etc. and makes it very hard to detect whether or not you're actually on a myBlog page rather than a normal content page.
However, the "show" parameter is still in there, which it's not on normal content pages, so we can use that to toggle with when you are viewing individual blog entries. The main blog front page however doesn't have the "show" parameter so it's no good there.
When you're viewing a blog category page, the parameter "category" is used, which again is not found in com_content pages, so that could be used as a toggle.
The "tags" page keeps $option as com_myblog.
The "blogger" pages have a parameter "blogger" on them.
Back to your original request: to target the front page of the blog, when it's set as default on the site:
I think you could probably go for this:
if ($option == "com_content"
and JRequest::getVar("category") == ""
and JRequest::getVar("show") == ""
and JRequest::getVar("blogger") == ""
and JRequest::getVar("task") == "view"
) return 37;
Hope that works this time! Thanks for finding the plugin thing, that helped a lot!
Board Info
- Board Stats:
- Total Topics:
- 1689
- Total Polls:
- 6
- Total Posts:
- 5943
- Posts this week:
- 2
- User Info:
- Total Users:
- 7642
- Newest User:
- mary26
- Members Online:
- 0
- Guests Online:
- 155
- Online:
- There are no members online
Forum Legend:
Topic
New
Locked
Sticky
Active
New/Active
New/Locked
New Sticky
Locked/Active
Active/Sticky
Sticky/Locked
Sticky/Active/Locked