Page 1 of 2
How to include HTML into special category pages only
Posted: Tue Jun 25, 2013 2:47 pm
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?
Re: How to include HTML into special category pages only
Posted: Tue Jun 25, 2013 6:22 pm
by admin
Check $_GET parameters, it's fast.
Re: How to include HTML into special category pages only
Posted: Tue Jun 25, 2013 7:58 pm
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?
Re: How to include HTML into special category pages only
Posted: Wed Jun 26, 2013 8:27 am
by admin
There is nothing to $_GET from it.
what do you mean ?
Re: How to include HTML into special category pages only
Posted: Wed Jun 26, 2013 8:53 am
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?
Re: How to include HTML into special category pages only
Posted: Wed Jun 26, 2013 9:18 am
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");
}
?>
Re: How to include HTML into special category pages only
Posted: Wed Jun 26, 2013 12:55 pm
by admin
I suggest you to add something like
print_r($_GET);
and find out that you actually have $_GET parameters.
Yes, php code is friendly.
Re: How to include HTML into special category pages only
Posted: Thu Jun 27, 2013 6:16 am
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?
Re: How to include HTML into special category pages only
Posted: Thu Jun 27, 2013 6:30 am
by admin
check $_GET['page']
Re: How to include HTML into special category pages only
Posted: Thu Jun 27, 2013 10:18 am
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
