Jump to content

Recommended Posts

Hello,

I am new to this forum and to PHP.

I have a code that I got but I can't get it to call the correct page. 

I am not sure if there is a special code that I have to put on the page that I am trying to call or what.

here is the code that I have for my Nav.

I have the page "see.php" loaded in the root folder. and for this page I just copied what was already used for the other pages and just added a movie. but when I use /see/  it doesn't find the page.

Like I said I am super new at PHP but I really want to learn.

please let me know if you need more.

Thank you

[code]<?php
$menu = <<<MENU
<div id="mn">
<ul id="menu">
<li id="home"><a href="/" title="Welcome to the Jupiter Hotel.">Home</a></li>
<li id="reserve"><a href="/reserve/" title="Get a room!">Reserve</a></li>
<li id="groups"><a href="/groups/" title="Group Packages">Groups</a></li>
<li id="play"><a href="/play/" title="Have a good time">Play</a></li>
<li id="deals"><a href="/deals/" title="Learn about hot deals.">Deals</a></li>
<li id="buzz"><a href="/buzz/" title="Read about Jupiter Hotel's buzz.">Buzz</a></li>
<li id="gallery"><a href="/see/" title="View images.">Gallery</a></li>

</ul>
</div>
MENU;
// adds id="active" to the active menu item by matching the url
// code from: http://photomatt.net/scripts/intellimenu
$lines = split("\n", $menu);
foreach ($lines as $line) {
    $current = false;
    preg_match('/href="([^"]+)"/', $line, $url);
    if (substr($_SERVER["REQUEST_URI"], 0, 5) == substr($url[1], 0, 5)) {
        $line = str_replace('<a h', '<a id="active" h', $line);
        }
    echo $line."\n";
}
?>[/code]

Here is also the code to the see.php page

[code]<?php $page_title = "Word on the street"; ?>
<?php include("_php/page_open.php"); ?>
<script type="text/javascript" src="/_js/prototype.js"></script>
<script type="text/javascript" src="/_js/scriptaculous.js?load=effects"></script>
<script type="text/javascript" src="/_js/lightbox.js"></script>
<link rel="stylesheet" href="/_c/lightbox.css" type="text/css" media="screen" />
<div id="content">


<div id="left">
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="263" height="396" align="middle" class="greyborder">
<param name="allowScriptAccess" value="sameDomain" />
<param name="movie" value="_swf/gallery_slideshow.swf" wmode="transparent" />
<param name="quality" value="high" wmode="transparent"/>
<param name="bgcolor" value="#cccccc" wmode="transparent"/>
<embed wmode="transparent" src="_swf/gallery_slideshow.swf" quality="high" bgcolor="#cccccc" width="263" height="396" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
</embed>
</object>
</div>
<div id="right_gal">


<h2 class="chiller">Your eyes will thank you. </h2>

  <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="320" height="240" class="greyborder">
    <param name="movie" value="_videos/tripfilm.swf" />
    <param name="quality" value="high" />
    <embed src="_videos/tripfilm.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="320" height="240"></embed>
  </object>
  <br />
    <span style="font-style: italic; font-size: x-small;">Video may take a minute to load...</span></p>
      <p>&nbsp;      </p>
      <p>    <strong>g a l l e r y :</strong> <a href="http://jupiterhotel.blogspot.com/" target="_blank">Let your eyes have some fun</a> </p>
<p>&nbsp;</p>
</div>

</div>
</div>




<?php include("_php/page_close_see.php"); ?>[/code]
Link to comment
https://forums.phpfreaks.com/topic/33946-new-to-php-cant-get-page-to-load/
Share on other sites

Hi,

[quote]<li id="home"><a href="/" title="Welcome to the Jupiter Hotel.">Home</a></li>[/quote]

Above is your first item in the list. It seems to me the link does not link to any file, just the root dir ( / ).
If you wanted the above link to ope the 'see.php' page you'd need to have this:

  <li id="home"><a href="/see.php" title="Welcome to the Jupiter Hotel.">Home</a></li>

Provided, as you point out, that the 'see.php' page is in the root dir.
that is what I thought also,

but that link is just for the Home page  "index.php"

the but others in the code /reserve/ and what not actually link to reserve.php

so how does that happen?

[code]<li id="reserve"><a href="/reserve/" title="Get a room!">Reserve</a></li>
<li id="groups"><a href="/groups/" title="Group Packages">Groups</a></li>
<li id="play"><a href="/play/" title="Have a good time">Play</a></li>
<li id="deals"><a href="/deals/" title="Learn about hot deals.">Deals</a></li>
<li id="buzz"><a href="/buzz/" title="Read about Jupiter Hotel's buzz.">Buzz</a></li>[/code]

all those actually link to there php page and not a folder.
There is probably what's called a .htaccess file which dynamically changes the URL /reserve/ to reserve.php for instance.
This is done at the server level, not with PHP. If you are able to access the site via FTP then you should be able to find that file and download it, and we can help change it.
ok so I got the .htaccess file and made some changes and then uploaded it to the server... everything was working fine, then I made some more changes and now those don't work.

the changes I made before work fine but not the new ones.

here is the code.

the /packages/ doesn't work for me.

[code]
RewriteEngine on
RewriteBase  /

RewriteRule ^sleep$ /sleep/ [R]
RewriteRule ^sleep/$ sleep.php

RewriteRule ^groups$ /groups/ [R]
RewriteRule ^groups/$ groups.php

RewriteRule ^reserve$ /reserve/ [R]
RewriteRule ^reserve/$ reserve.php

RewriteRule ^play$ /play/ [R]
RewriteRule ^play/$ play.php

RewriteRule ^eat$ /play/ [R]
RewriteRule ^eat/$ /play/ [R]
RewriteRule ^consume$ /play/ [R]
RewriteRule ^consume/$ /play/ [R]

RewriteRule ^connect$ / [R]
RewriteRule ^connect/$ / [R]

RewriteRule ^deals$ /deals/ [R]
RewriteRule ^deals/$ deals.php

RewriteRule ^buzz$ /buzz/ [R]
RewriteRule ^buzz/$ buzz.php

RewriteRule ^see$ /see/ [R]
RewriteRule ^see/$ see.php

RewriteRule ^beta$ /beta/ [R]
RewriteRule ^beta/$ beta.php

RewriteRule ^contact$ /contact/ [R]
RewriteRule ^contact/$ contact.php

RewriteRule ^packages$ /packages/ [R]
RewriteRule ^packages/$ packages.php

RewriteRule ^tester$ /tester/ [R]
RewriteRule ^tester/$ tester.php

[/code]

this is the same format I used when I first made some mods and it worked fine.  I copied this from another site I was working on.

Please help!!  this has been at me for about 5 days now.
I don't see the point in this:
[code]
RewriteRule ^groups$ /groups/ [R]
RewriteRule ^groups/$ groups.php
[/code]

Won't this rewrite [b]groups[/b] to [b]groups/[/b] which will then redirect the groups.php

Since the end in either case is groups.php change each of your double lines to the bottom one with a question mark:
[code]
RewriteRule ^groups/?$ groups.php
[/code]

This way [b]groups[/b] and [b]groups/[/b] will rewrite to the right page without an extra request.
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.