wezze Posted July 9, 2012 Share Posted July 9, 2012 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 thx Quote Link to comment https://forums.phpfreaks.com/topic/265430-include-menu-question/ Share on other sites More sharing options...
redarrow Posted July 9, 2012 Share Posted July 9, 2012 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. Quote Link to comment https://forums.phpfreaks.com/topic/265430-include-menu-question/#findComment-1360292 Share on other sites More sharing options...
redarrow Posted July 9, 2012 Share Posted July 9, 2012 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. Quote Link to comment https://forums.phpfreaks.com/topic/265430-include-menu-question/#findComment-1360295 Share on other sites More sharing options...
wezze Posted July 9, 2012 Author Share Posted July 9, 2012 so the only file that needs to be in my root is index.php? and stuff like admin center? what do you mean with autoload files?? thx Quote Link to comment https://forums.phpfreaks.com/topic/265430-include-menu-question/#findComment-1360308 Share on other sites More sharing options...
redarrow Posted July 9, 2012 Share Posted July 9, 2012 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. Quote Link to comment https://forums.phpfreaks.com/topic/265430-include-menu-question/#findComment-1360316 Share on other sites More sharing options...
xyph Posted July 9, 2012 Share Posted July 9, 2012 Well, your approach is kinda wonky. If they're related, and link to each other, why are they in different directories? Quote Link to comment https://forums.phpfreaks.com/topic/265430-include-menu-question/#findComment-1360324 Share on other sites More sharing options...
wezze Posted July 9, 2012 Author Share Posted July 9, 2012 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? Quote Link to comment https://forums.phpfreaks.com/topic/265430-include-menu-question/#findComment-1360336 Share on other sites More sharing options...
xyph Posted July 9, 2012 Share Posted July 9, 2012 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. Quote Link to comment https://forums.phpfreaks.com/topic/265430-include-menu-question/#findComment-1360339 Share on other sites More sharing options...
wezze Posted July 9, 2012 Author Share Posted July 9, 2012 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 Quote Link to comment https://forums.phpfreaks.com/topic/265430-include-menu-question/#findComment-1360346 Share on other sites More sharing options...
xyph Posted July 9, 2012 Share Posted July 9, 2012 You should do something along the lines of this http://www.devlounge.net/code/multiple-languages-on-any-page-dynamically Copy the concept, not the code Quote Link to comment https://forums.phpfreaks.com/topic/265430-include-menu-question/#findComment-1360349 Share on other sites More sharing options...
wezze Posted July 12, 2012 Author Share Posted July 12, 2012 i found a solution of a multi language script with ajax,mysql,php im trying to understand it but the menu problem is solved. thx Quote Link to comment https://forums.phpfreaks.com/topic/265430-include-menu-question/#findComment-1361071 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.