[advanced search]
 

Go Back   NamePros.com > Discussion > Web Design & Development > Programming

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.


Closed Thread
 
LinkBack Thread Tools
Old 11-07-2007, 11:44 AM   #1 (permalink)
NamePros Member
 
Join Date: Jan 2007
Posts: 68
0.00 NP$ (Donate)

baris22 is an unknown quantity at this point


include function with mode rewrite?

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
baris22 is offline  
Old 11-07-2007, 12:44 PM   #2 (permalink)
Danltn.com
 
Daniel's Avatar
 
Join Date: May 2007
Location: Danltn.com / Nottingham, UK
Posts: 1,201
13.51 NP$ (Donate)

Daniel has a reputation beyond reputeDaniel has a reputation beyond reputeDaniel has a reputation beyond reputeDaniel has a reputation beyond reputeDaniel has a reputation beyond reputeDaniel has a reputation beyond reputeDaniel has a reputation beyond reputeDaniel has a reputation beyond reputeDaniel has a reputation beyond reputeDaniel has a reputation beyond reputeDaniel has a reputation beyond repute

Ethan Allen Fund Ethan Allen Fund
Your method of doing it isn't pretty. But if you would want to expand this method...

PHP Code:
<?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;
                }                
?>
Daniel is offline  
Old 11-07-2007, 12:54 PM   #3 (permalink)
NamePros Member
 
Join Date: Jan 2007
Posts: 68
0.00 NP$ (Donate)

baris22 is an unknown quantity at this point


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



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

PHP Code:
<?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;
                }                
?>
baris22 is offline  
Old 11-07-2007, 01:08 PM   #4 (permalink)
Danltn.com
 
Daniel's Avatar
 
Join Date: May 2007
Location: Danltn.com / Nottingham, UK
Posts: 1,201
13.51 NP$ (Donate)

Daniel has a reputation beyond reputeDaniel has a reputation beyond reputeDaniel has a reputation beyond reputeDaniel has a reputation beyond reputeDaniel has a reputation beyond reputeDaniel has a reputation beyond reputeDaniel has a reputation beyond reputeDaniel has a reputation beyond reputeDaniel has a reputation beyond reputeDaniel has a reputation beyond reputeDaniel has a reputation beyond repute

Ethan Allen Fund Ethan Allen Fund
PHP Code:
  <?php

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

$page = "video_files.html";

if (
$currentpage == $page)
{
                include (
'ads.php');
}
?>
Daniel is offline  
Old 11-07-2007, 01:17 PM   #5 (permalink)
NamePros Member
 
Join Date: Jan 2007
Posts: 68
0.00 NP$ (Donate)

baris22 is an unknown quantity at this point


Quote:
Originally Posted by Danltn
PHP Code:
  <?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
baris22 is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Site Sponsors
Advertise your business at NamePros

All times are GMT -7. The time now is 05:54 AM.


Powered by: vBulletin® Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0
Template-Modifications by TMS
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85