electripunk Posted March 19, 2009 Share Posted March 19, 2009 Ok, first of all, I am new to php and css. I am rewriting a script that I liked the idea, but the layout was no good, and half the links were no good. So now I am still in the beginning with the home page, an about.php , and the normal footer, header, under an inc sub directory, and a lib sub directory with a function.php I am trying to get the contact us page up. The way it is written uses a contact.php and its own index.php. I have the same tag to include the header, but it does not seem to work. In my root directory, my include code is include('config.php'); include ($sm['path_inc'] . 'header.php'); $sm['page_name'] = 'Welcome to ' . $sm['page_name']; but in the sub directory it is include('../config.php'); include ($sm['path_inc'] . 'header.php'); $sm['page_name'] = 'Welcome to ' . $sm['page_name']; However, on the contact us page, my header image does not show up. All the css works, and the menus work and are accessable. This has had me stumped for a day and a half. Why cant I get my site logo to show up in a index.php located in a sub directory? Someone please help... Quote Link to comment Share on other sites More sharing options...
lewisstevens1 Posted March 19, 2009 Share Posted March 19, 2009 ...well i found out in alot of my code, when im trying to put a navigation url, it normally works if i take the . out so try include('/config.php'); include ($sm['path_inc'] . 'header.php'); $sm['page_name'] = 'Welcome to ' . $sm['page_name']; problem is, that would only like to the file in the same directory, if you wanted one in another directory you would have to do something like this, e.g. my folder is called Newfolder and my file im trying to link to is called Newfile.php: include('Newfolder/Newfile.php')... is this what you were trying to get at? Quote Link to comment Share on other sites More sharing options...
electripunk Posted March 19, 2009 Author Share Posted March 19, 2009 Thank you very much for your suggestions. I have tried to post it without the ".." before "/config.php" but it gave me errors every time I tried to leave the page with a link. My config file hase a path_inc definition. That is where the include ($sm['path_inc'] . 'header.php'); comes in. The ../config.php works I know it works because all my links are working and my header, and footer show up. The problem is that my image will not show up when the header is linked with php from a sub directory. in short, include ($sm['path_inc'] . 'header.php'); is actually "html/test/inc/header.php" the root is /test/ the issue is when I test the site, everything works up until html/test/contact/index.php <~~~this page will not show the site logo in the header, but still displays everything else in the header. I am usinga .png for the site logo. Quote Link to comment Share on other sites More sharing options...
electripunk Posted March 19, 2009 Author Share Posted March 19, 2009 PROBLEM SOLVED!!! Apparently I had some issues in my config.php file. Not sure why this worked, but I changed $sm['dir_images'] = 'specific directory tree beginning before the html/ directory /test/images/'; to simply $sm['dir_images'] = '/test/images/'; then I actually used the link to the config.php file in my contact form, and updated my header.php to <img src="{dir_base}logo.png"> Works great!! Thank you for your suggestions. Quote Link to comment 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.