Include function with mode rewrite?

Namecheap AuctionsNamecheap Auctions
SpaceshipSpaceship
NamecheapNamecheap
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
Close
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
Close
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
Close
PHP:
  <?php

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

$page = "video_files.html";

if ($currentpage == $page)
{
				include ('ads.php');
}
?>
 
0
Close
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
Close
DomainEasy: white label portfolios are live. Enable yours.

We're social

Escrow.com
Spaceship
Domain Recover
CryptoExchange.com

NamePros updates

Switch between accounts
You can now stay logged in to more than one NamePros account in the same browser. Click your avatar, then "Accounts in this browser", to...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back