Jump to content

Welcome to MSFN Forum
Register now to gain access to all of our features. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more. This message will be removed once you have signed in.
Login to Account Create an Account



Photo

[PHP] Need little help with a small script

- - - - -

  • Please log in to reply
1 reply to this topic

#1
Outbreaker

Outbreaker

    Advanced Member

  • Member
  • PipPipPip
  • 300 posts
  • Joined 08-August 07
  • OS:Windows 7 x86
  • Country: Country Flag
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, 29 May 2013 - 04:27 AM.



How to remove advertisement from MSFN

#2
mark32

mark32
  • Member
  • 3 posts
  • Joined 10-June 13
Can able to find an error in your script. I have seen it completely but failed to locate error.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users