Jump to content

Integrating a gallery in an existing webpage (PHP)


PAFTprod

Recommended Posts

Ok my current websites functions in this way:

I got an index.php which contains the template of the website, it uses url links for the menus like this:

[i]<a href="?page=media"> IMAGE LINK </a>[/i]

further down on the page where i want it to change depending on which menu button u click i got this:

[i]<?php
$page = $HTTP_GET_VARS['page'];
if (!isset($page) || $page == "") { $page = "home"; }
include ("$page.php");
?>[/i]


So in the case above it would load the media.php file into the index.php page..

[b]Problem 1:[/b]

Now i want to use the same concept, but on the media.php page i want links to a video page, gallery page etc.. both being under another folder /video and /gallery respectively. I want it so that when i click the gallery link the gallery.php loads in the place of the media.php. It has to keep my index.php on the rest of the page. I really dont know how to do the php linking for this - going into a subfolder.

[b]2nd Problem:[/b]

I've managed to put the gallery into the same folder as the rest of my site and make it display inside my index.php as gallery.php. This is extremely messy in my FTP so i need to solve problem 1 first. When problem 1 is solved i need to fix this:

As soon as i click a link from the gallery that i imported from an online freeware script.. say another page inside theg gallery it jumps out of my index.php page..and goes into standard gallery page removing the rest of my website design. So my question is what do i do to fix these links so that it keeps within my index.php file? And what do i write?

-----------

If anyone can help me out with this.. i would be extremely greatful!
Link to comment
Share on other sites

I am having a hard time understanding the problems...

But this is wrong:
[code=php:0][hr]<?php
$page = $HTTP_GET_VARS['page'];
if (!isset($page) || $page == "") { $page = "home"; }
include ("$page.php");
?>[/code][hr]

Change it to:
[code=php:0][hr]<?php
$page = $HTTP_GET_VARS['page'];
if (!isset($_GET['page']) || $_GET['page']== "") {$page = "home";}
else{$page = $_GET['page'];};
include ($page.".php");
?>[/code][hr]


Orio.
Link to comment
Share on other sites

Aite i made the change that you wrote..

<?php
$page = $HTTP_GET_VARS['page'];
if (!isset($_GET['page']) || $_GET['page']== "") {$page = "home";}
else{$page = $_GET['page'];};
include ($page.".php");
?>

but the one i wrote works as well. The problem is that i got a gallery script that is in a sub-folder from my index.php ( /index.php and my gallery script in /gallery/index.php) - I want to link to it properly using php, so was wondering how to do that in the following:

<a href="?????"> IMAGE LINK </a>


-------------------- 2nd problem is this:

Lets say that ive fixed the issue above - I now face this problem:

As soon as i click a link on the gallery/index.php that has been imported into my /index.php it jumps out of my /index.php file and shows the gallery in a completely refreshed window without my original /index.php design.

According to the guys that wrote this gallery script i need to do the following:

[i]Since v0.9.10 it has been possible to include singapore into your web design using external.php. Just place this code where you want singapore to appear: <?php include("path/to/singapore/external.php");?> (supplying the correct relative or absolute path to singapore instead of '/path/to/singapore'). There are, however, a few things that need to be noted:

You will almost certainly need to edit your chosen template in order that the HTML generated is still valid. For example you do not want two <html> start tags, two <head> sections etc. Alternatively you can use the external template (available to download from the website) which is the default template with the unnecessary (X)HTML removed.

If the file into which you are including singapore is named something other than index.php or it requires additional GET variables (such as page etc.) then you will need to change index_file_url to reflect this. For example if the page you are including singapore into is site.php?page=gallery you will need to change index_file_url to site.php?page=gallery&amp; [/i]

Now i tried both solutions.. and i got the following error on my page:


[i]Warning: main(): open_basedir restriction in effect. File(/gallery/external.php) is not within the allowed path(s): (/.../:/usr/lib/php:/usr/local/lib/php:/tmp) in /.../public_html/testing2/test.php on line 7

Warning: main(/gallery/external.php): failed to open stream: Operation not permitted in /..../public_html/testing2/test.php on line 7

Warning: main(): open_basedir restriction in effect. File(/gallery/external.php) is not within the allowed path(s): (/..../:/usr/lib/php:/usr/local/lib/php:/tmp) in /...../public_html/testing2/test.php on line 7

Warning: main(/gallery/external.php): failed to open stream: Operation not permitted in /..../public_html/testing2/test.php on line 7

Warning: main(): Failed opening '/gallery/external.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /..../public_html/testing2/test.php on line 7[/i]
Link to comment
Share on other sites

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.