Jump to content
Strawberry Orange Banana Lime Leaf Slate Sky Blueberry Grape Watermelon Chocolate Marble
Strawberry Orange Banana Lime Leaf Slate Sky Blueberry Grape Watermelon Chocolate Marble

MSFN is made available via donations, subscriptions and advertising revenue. The use of ad-blocking software hurts the site. Please disable ad-blocking software or set an exception for MSFN. Alternatively, register and become a site sponsor/subscriber and ads will be disabled automatically. 



Sign in to follow this  
Outbreaker

[PHP] Need little help with a small script

Recommended Posts

Outbreaker    1

HI,

I try to do a little script for Joomla (CMS) that would add a HTML "<div></div>" tag line based on the first category page (entry page) and the browser user-agent.

But the problem i have is to only run the script on the first category page (entry page).

This is the working PHP Script that would outputting a different "<div></div>" tag if a user-agent.is detected.

if (preg_match('/(Test1-Bot|Test2-bot)/i', $_SERVER['HTTP_USER_AGENT']))
{
echo '<div class="cloud1">';
}
else
{
echo '<div class="cloud2">';
}
<p>Some HTML Output</p>
</div>

So now the problem is that i want to run the above PHP Script only on the first category page (entry page) but i have problems to code this (Beginner).

This script would show it on all Blog pages:

if ( 
$option == 'com_content'
and $view == 'category'
and $id == '8'
and $Itemid == '101'
and $jinput->get('layout') == 'blog' /*!*/
) return XXX;

And this script would show it only on the Blog page 2.

if ( 
$option == 'com_content'
and $view == 'category'
and $id == '8'
and $Itemid == '101'
and $jinput->get('layout') == 'blog' /*!*/
and $jinput->get('limitstart') == '4' /*!*/
and $jinput->get('start') == '4'
) return XXX;

How could i code a script that would run the above user-agent script only on Blog Page 1 (enter page)?

Edited by Outbreaker

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×