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

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

Can able to find an error in your script. I have seen it completely but failed to locate error.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...