Welcome to MSFN

Register now to gain access to all of our features. Once registered and logged in, you will be able to contribute to this site by submitting your own content or replying to existing content. You'll be able to customize your profile, receive reputation points as a reward for submitting content, while also communicating with other members via your own private inbox, plus much more! This message will be removed once you have signed in.


Sign in to follow this  
Followers 0
Outbreaker

[PHP] Need little help with a small script

2 posts in this topic

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
0

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.

0

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  
Followers 0

  • Recently Browsing   0 members

    No registered users viewing this page.