How to include HTML into special category pages only

SpyCam
Posts: 736
Joined: Fri Oct 26, 2012 9:52 am

How to include HTML into special category pages only

Post by SpyCam »

Hello,
what is the best and easy method (eating least server sesources) to add a HTML code into just one or a few specific category pages?

I have 1k categories and I want to add one hard link into let's say "Cartoon" category page, just to 1st page ranked by CTR.

What would be your suggestions?
admin
Site Admin
Posts: 38004
Joined: Wed Sep 10, 2008 11:43 am

Re: How to include HTML into special category pages only

Post by admin »

Check $_GET parameters, it's fast.
Don't forget to run script update
SpyCam
Posts: 736
Joined: Fri Oct 26, 2012 9:52 am

Re: How to include HTML into special category pages only

Post by SpyCam »

If my page looks like this:
http://www.lazymike.com/popular/cartoon ... 82x1464449

There is nothing to $_GET from it.
What would you suggest in this case?
admin
Site Admin
Posts: 38004
Joined: Wed Sep 10, 2008 11:43 am

Re: How to include HTML into special category pages only

Post by admin »

There is nothing to $_GET from it.
what do you mean ?
Don't forget to run script update
SpyCam
Posts: 736
Joined: Fri Oct 26, 2012 9:52 am

Re: How to include HTML into special category pages only

Post by SpyCam »

I mean I don't have ?group_name=cartoon so I can't use $_GET['group_name'] = 'cartoon'; as my URL is http://www.lazymike.com/popular/cartoon ... 82x1464449

What do you suggest?
SpyCam
Posts: 736
Joined: Fri Oct 26, 2012 9:52 am

Re: How to include HTML into special category pages only

Post by SpyCam »

I thought about using this, but not sure if it is server resources friendly

Code: Select all

<?php
$url = 'http://' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
if (false !== strpos($url,'popular/cartoon/1.html')) {
include("./file.html");
}
?>
admin
Site Admin
Posts: 38004
Joined: Wed Sep 10, 2008 11:43 am

Re: How to include HTML into special category pages only

Post by admin »

SpyCam wrote:I mean I don't have ?group_name=cartoon so I can't use $_GET['group_name'] = 'cartoon'; as my URL is http://www.lazymike.com/popular/cartoon ... 82x1464449

What do you suggest?
I suggest you to add something like

print_r($_GET);

and find out that you actually have $_GET parameters.

Yes, php code is friendly.
Don't forget to run script update
SpyCam
Posts: 736
Joined: Fri Oct 26, 2012 9:52 am

Re: How to include HTML into special category pages only

Post by SpyCam »

OK, this code also works:

Code: Select all

<?php
if ($_GET['group_name'] = 'cartoon') {
include("./file.html");
}
?>
But it works for all pages under cartoon category, and i want just 1st page ranked by CTR.
Do I need more if conditions to add or it is better/faster to use just strpos like I already use?
admin
Site Admin
Posts: 38004
Joined: Wed Sep 10, 2008 11:43 am

Re: How to include HTML into special category pages only

Post by admin »

check $_GET['page']
Don't forget to run script update
SpyCam
Posts: 736
Joined: Fri Oct 26, 2012 9:52 am

Re: How to include HTML into special category pages only

Post by SpyCam »

Code: Select all

<?php
if ($_GET['group_name'] = 'cartoon' && $_GET['order'] = 'ctr' && $_GET['page'] = '1') {
include("./file.html");
}
?>
this code doesn't work like I want :(
Post Reply