NameSilo

Include function with mode rewrite?

Spaceship Spaceship
Watch

baris22

Established Member
Impact
1
Hello all,

I am using this to include a page
Code:
$homepage = "http://www.x.com/video_files.html";
$currentpage = $_SERVER['REQUEST_URI'];  
if($homepage==$currentpage) {
include('ads.php');

I started using mode rewrite. When I go to the second page my url changes to http://www.x.com/2/video_files.html

So, how can i still use include function.

Thanks
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
Your method of doing it isn't pretty. But if you would want to expand this method...

PHP:
<?php

$currentpage = $_SERVER['REQUEST_URI'];

$homepage = array
				(
				"/test/showadsperpage.php",
				"/some_other_page.html",
				);


foreach ($homepage as $name)
				if ($currentpage == $name)
				{
								include ('ads.php');
								break;
				}				
?>
 
0
•••
I must have over 500 pages for video_files.html

My page listings are like this

http://www.x.com/video_files.html
http://www.x.com/1/video_files.html
http://www.x.com/2/video_files.html
http://www.x.com/3/video_files.html
http://www.x.com/4/video_files.html
...

I do not think it will be a good idea to list all the urls.

is there any other way.

Thanks



Danltn said:
Your method of doing it isn't pretty. But if you would want to expand this method...

PHP:
<?php

$currentpage = $_SERVER['REQUEST_URI'];

$homepage = array
				(
				"/test/showadsperpage.php",
				"/some_other_page.html",
				);


foreach ($homepage as $name)
				if ($currentpage == $name)
				{
								include ('ads.php');
								break;
				}				
?>
 
0
•••
PHP:
  <?php

$currentpage = array_shift(explode('?', basename($_SERVER['REQUEST_URI'])));

$page = "video_files.html";

if ($currentpage == $page)
{
				include ('ads.php');
}
?>
 
0
•••
Danltn said:
PHP:
  <?php

$currentpage = array_shift(explode('?', basename($_SERVER['REQUEST_URI'])));

$page = "video_files.html";

if ($currentpage == $page)
{
				include ('ads.php');
}
?>


Waw thank you very much.

it worked.

I wile check my paypal, if i have got anything i will try to donate.

Thanks again
 
0
•••
Dynadot — .com Registration $8.99Dynadot — .com Registration $8.99

We're social

Unstoppable Domains
Domain Recover
DomainEasy — Zero Commission
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back