Jump to content

include menu question


wezze

Recommended Posts

Hi im using includes for my menu's now the problem i have is when files are in the same folder its easy i just use

<a href=\"test1.php\">test1</a>

when sub folder

<a href=\"../test1.php\">test1</a>

but what to do with this??

lets say your this is my menu

if($session->isAdmin()) {
echo "<li><a href=\"../test.php\">test</a></li>";
echo "<li><a href=\"test1.php\">test1</a></li>";
    echo "<li><a href=\"../test2.php\">test2</a></li>";
echo "<li><a href=\"../testfolder/test3.php\">test3</a></li><br>";
}

 

now lets say im on page test1 and click the test3 page ill go to test3 page,

 

now heres my problem when on page test3 and clicking page test i get an error causse i use the same menu as include for everything is there a way

to fix this??

 

hope my example makes any sense  :D

thx

Link to comment
Share on other sites

the way your setting up your folders are silly billy.

 

index.php

index.php/images/image.gif

index.php/javascript/what_ever.jsp

index.php/html/template.html

 

home folder ------ then image folder ----- JavaScript folder------html folder----------

 

you should be spelling out the folders in realty, not good for seo what your doing sorry.

 

sorry all i no.

 

lets also image that the service provider for all your files went down for good then the next provider got complete different folder structure ill be upset.

 

also let look at a folder, it true to say that in seo one just one extra target word might win your competitors and that can be written as a folder name.

 

i am just saying you can do what you want only p[pointing out facts.

Link to comment
Share on other sites

from a writer of php books

 

 

You should have one directory as web root, where only files you want exposed to the whole internet should reside.

 

project/

web/

  index.php

  css/

  js/

  images/

config/

lib/

 

    web/ is the root shown to visitors

    lib/ is here the library folder, and where autoload look for files.

 

You can add more subfolders to project/ like controller, modules, view, helper, etc. This depeds on your framework.

 

Link to comment
Share on other sites

your correct, auto load files are files that need to start self working usually a database of updates.

 

the folder you got with your host index.php is the folder you add folder in ok...

 

after adding folders then you can use all them flash back and forward slashes.

not recommended  as said ok.

Link to comment
Share on other sites

ok im working on my new folder structure now.

but stuff like lightbox where do i put that do i strip that folder too, so js, css ,images do i put them within my js, css, images folder or do i leave it like that?

 

made this up till now

/name

  /www

    index.php

  /js

  /includes

  /images

  /css

 

The reason my folder structure was like this is because of...lazzynes? :P

Link to comment
Share on other sites

No, but keeping lightbox resources in a different directory won't cause the kind of behaviour you're describing in your OP.

 

If you need to use similar output code in multiple php pages, it's a good idea to keep those pages in the same directory... for simplicities sake.

Link to comment
Share on other sites

what about 2 languages would this causse any problems?

 

 

/name

  /www

    /nl

      index.php

    /fr

      index.php

  /js

  /includes

  /nl

  /fr

  /images

  /css

  /lightbox

 

thanks

 

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.