Jump to content

Help with includes


MikiCatDesigns
Go to solution Solved by Ch0cu3r,

Recommended Posts

Sorry for the long message but I need HELP!!!  I'm somewhat familiar with HTML but very little in PHP, and even less in CSS. My eCommerce program is PHP based so I've had to learn to work with it. I did have someone else initially setup and create my website but over the past few years have taken it further myself. I've fiddled with some of it and looked up how to do certain things, such as have only one header and/or sidebar I can use for all pages. I use Dreamweaver CS4 and FTP with FileZilla. But I'm still new at this and have run into a couple of issues.

 

My webhost is GoDaddy, my website is MikiCat Designs and after fiddling for months, in March finally got my site to where I liked it. Unfortunately, I haven't kept it up. Anyway, I went there a couple of weeks ago and found that the PHP includes I'd had in the HTML files were no longer working. I get the error [an error occurred while processing this directive]. Weird. Worked fine before, now it doesn't. Called GoDaddy who says they didn't do anything . Uh huh. Now I know I didn't do anything since I haven't updated the site in 4 months! So, what could have caused this problem?

I've had no idea how to fix it other than to change the index.html to index.php and, of course, do a minor repair on the include. Works fine and my header.php and leftsidebar.php show up again. Yay! Herein lies another problem.

My header and sidebar link to other files some of which were HTML files. But those HTML files had the same header and sidebar issues as my INDEX file. This had to be fixed so I changed them to PHP. Still working on the changes. I deleted most of the HTML files from the server.

So the links in my header and lefsidebar files now point to PHP files. e.g., gallery.html to gallery.php. When called on it's own, gallery.php shows up perfectly. But, no matter what I do, the header file still tries to load the HTML file!!! It's driving me crazy. What have I done wrong? I've deleted them both, refreshed, cleared cache and uploaded them again but I still get the same error. If you click on Gallery in the header, it tries to link gallery.html not gallery.php! Funny thing is, the leftsidebar now works perfectly and points to the proper PHP files. I'm completely confused now.

I don't know why my header is insisting on trying to load the HTML page instead of the PHP. But here's my header code. Lines 41 and 42 work, lines 43, 44 and 45 do not.

 

* Quietly banging head against wall while awaiting help. :facewall:

<html>
  <body>
  <!-- begin #header -->
  <!-- begin Facebook script -->
  <div id="fb-root"></div>
  <script>(function(d, s, id) {
    var js, fjs = d.getElementsByTagName(s)[0];
    if (d.getElementById(id)) return;
    js = d.createElement(s); js.id = id;
   js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";
   fjs.parentNode.insertBefore(js, fjs);
 }(document, 'script', 'facebook-jssdk'));</script>
 <!-- end Facebook script -->
 
 <div id="container">
 
 <div id="headerright">
 <form method="post" action="search.php"> 
 <input type="hidden" name="posted" value="1"/> 
 <input type="text" name="stext" size="16"/>
 <input type="submit" name="Search" value="Search"/> </form>
 </div>
 
 <div id="headerright1">
 <form method="post" action="cart.php">
 <input type="hidden" name="posted" value="1"/>
 <input type="image" name="Submit" src="images/cartgrn.gif" />
 </form></div>
 
 <div id="headerright2">
 <form method="post" action="clientlogin.php">
 <input type="hidden" name="posted" value="2"/>
 <input type="image" name="Submit" src="images/login2.gif" />
 </form>
 </div>
 
  <div id="header">
     <div id="PLHIMYFUFUJCDiv" style="position:absolute; left:567px; top:82px; width:490px; z-index:50; white-space:nowrap; direction:ltr;">
       <div id="PLHIMYFUFUJCMain" style="width:490px;height:40px">
         <ul style="margin:0px;padding:0px;font:italic normal bold 14px Georgia,Times New Roman,Times,serif;">
       <li style="float:left;list-style:none;text-align:center;width:98px;height:40px;background-image:url(images/homenav.gif);"><a href="http://www.mikicatdesigns.com" target="_self" title="MikiCat Designs" style="display:block;height:28px;padding:12px 0px 0px 0px;color:#00008b;text-decoration:none;">Home</a></li>
       <li style="float:left;list-style:none;text-align:center;width:98px;height:40px;background-image:url(images/homenav.gif);"><a href="http://www.mikicatdesigns.com/categories.php" target="_parent" title="Handmade jewelry and accessories " style="display:block;height:28px;padding:12px 0px 0px 0px;color:#00008b;text-decoration:none;">Products</a></li>
       <li style="float:left;list-style:none;text-align:center;width:98px;height:40px;background-image:url(images/homenav.gif);"><a href="http://www.mikicatdesigns.com/gallery.php" target="_parent" title="Handmade  jewelry gallery of past lives" style="display:block;height:28px;padding:12px 0px 0px 0px;color:#00008b;text-decoration:none;">Gallery</a></li>
       <li style="float:left;list-style:none;text-align:center;width:98px;height:40px;background-image:url(images/homenav.gif);"><a href="http://www.mikicatdesigns.com/aboutmikicatdesigns.php" target="_parent" title="Learn about MikiCat Designs" style="display:block;height:28px;padding:12px 0px 0px 0px;color:#00008b;text-decoration:none;">About Us</a></li>
       <li style="float:left;list-style:none;text-align:center;width:98px;height:40px;background-image:url(images/homenav.gif);"><a href="http://www.mikicatdesigns.com/contactmikicatdesigns.php" target="_parent" title="Contact MikiCat Designs" style="display:block;height:28px;padding:12px 0px 0px 0px;color:#00008b;text-decoration:none;">Contact Us</a></li>
       </ul></div><div id="PLHIMYFUFUJCLevel2" style="float:left;width:490px;height:40px;"></div>
 

	

  <script type="text/javascript" src="Pluginlab/Scripts/PLHIM.js">/* PLHIMMenu script ID:PLHIMYFUFUJC */</script>
     </div>
   <!-- end #header -->
Link to comment
Share on other sites

1 - you say you're familiar with css - why don't you build a css file and include THAT so you don't have ALL THAT MESS of CSS in your html?

2 - you say over and over how your includes aren't working yet the code you posted does not have a single include (or require) in it.  How are we supposed to help you?

Edited by ginerjm
Link to comment
Share on other sites

1 - Okay, maybe I'm misunderstood. I said I know even less about CSS than I do about HTML or PHP. I'm learning, but only as I go along. I'm not at all conversant with CSS. Like i said, this abortion, er um, code, was written by someone else intitially. You can't imagine how much cleanup I've already done.

 

2 - Perhaps I mislabeled the help I need. The first part of the issue was the includes not working. I seemed to have fixed that by changing the files to php and fixing the include code.

 

Now, for some reason, I have a link problem. My leftsidebar and footer files link to the other php files fine. The header, for some unknown and completely baffling reason, will not link to the php files but insists on pointing to the old html ones. I've searched my server for any other dupicate header files but there are none and I don't know why its doing what it's doing.

 

BTW, here's how I include the header and leftsidebar.

<!-- begin Header -->
	<?php include('header.php') ?>
<!-- end Header -->

<!-- begin index left sidebar -->
  <div id="sidebar1">
  <h3 class="h3size">Handmade jewelry just for you!</h3>
	<?php include('leftsidebar.php') ?>
  </div>
<!-- end #left sidebar -->
Link to comment
Share on other sites

It looks to me like this issue is the PLHIM menu plugin. It contains a variable called STREAM which has links to html versions of your files. Where this is a third-party script, I'm not sure how they go there as it looks auto-generated.

Link to comment
Share on other sites

Okay, I'm confused.  - boompa, I have no idea what you're talking about.

 

CroNIX, what do you mean by repost? It used to work fine. Like I've said, I've triple checked and there is only one header.php and I've checked it multiple times.

 

Example 1 - This line works and will link the correct file, categories.php.

      <li style="float:left;list-style:none;text-align:center;width:98px;height:40px;background-image:url(images/homenav.gif);"><a href="http://www.mikicatdesigns.com/categories.php" target="_parent" title="Handmade jewelry and accessories " style="display:block;height:28px;padding:12px 0px 0px 0px;color:#00008b;text-decoration:none;">Products</a></li>

Example 2 - This line does not work and insists on calling out to gallery.html instead of gallery.php. Unless, wait, thinking, could it have something to do with the... nah, beats me. Did I mention I was a total NOOB!?

      <li style="float:left;list-style:none;text-align:center;width:98px;height:40px;background-image:url(images/homenav.gif);"><a href="http://www.mikicatdesigns.com/gallery.php" target="_parent" title="Handmade  jewelry gallery of past lives" style="display:block;height:28px;padding:12px 0px 0px 0px;color:#00008b;text-decoration:none;">Gallery</a></li>
Edited by MikiCatDesigns
Link to comment
Share on other sites

Your last post is just fine.  If you the file does not exist where you think it should be, you'd get an error message from your browser.  Period.  Unless you have some kind of apache re-write rule in place(?).  More likely is that this exact piece of code is NOT what you are executing on your client.  Display the source of your web page before clicking the link and ensure it is the current file.

Link to comment
Share on other sites

No, you're correct. At this point I think boompa probably had it correct and that PLHIMMenu javascript plugin is manipulating the links.

 

Try removing this:

<script type="text/javascript" src="Pluginlab/Scripts/PLHIM.js">/* PLHIMMenu script ID:PLHIMYFUFUJC */</script>

And see if the links work just for troubleshooting....

Link to comment
Share on other sites

Well that can be changed with just CSS, but I think more importantly you lose your submenu. Personally, I'd just google for "css dropdown menu" and see how they do that WITHOUT the need for javascript. It will be a LOT smaller code-wise as well.

Link to comment
Share on other sites

But I'm not just looking for a sub or drop down menu. Only my Products link has that and it seems to work fine. I'm looking for the color change that happens when you mouseover the link in the header as well.

 

I just don't understand why its refusing to link to the correct file. It was working perfectly for over a year. (sigh) Is there a way to edit the script? Could that be what's causing it to seek out the old links instead of the new?

 

BTW, I do appreciate all your help!!!

Link to comment
Share on other sites

I have no idea about that particular script and when I viewed the source code for it I got a headache.   :)  You could check if there is documentation for it wherever you downloaded it from.

 

What I'd do is give your <ul> that contains all of your top links an ID, like <ul id="main-menu">

 

Then in the <head> of the document, look for the <style> section and create a new rule, like:

ul#main-menu li a:hover {color:red !important}

 

That basically says, whenever a <a> in the ul with an id of "main-menu" li is hovered (mouseover), change the color to red

Edited by CroNiX
Link to comment
Share on other sites

I suppose this is something else I'll have to figure out. Yeah the code is an abortion but you should have seen in when I first got it. Don't know where that woman thought she could setup websites. I think she just took really old code and changed, added to it for my site. Took my money and gave me something ugly and cumbersome. I asked for static headers, footers and sidebar. Didn't get that. So every time I needed to change something in any of them, I had to change ALL my files. And each one of my items for sale has to have their own PHP file. UGH.

 

So I fixed up most of it myself. Still working on it though I'm about to give up and just shut the whole thing down.

 

Can you give me a full example of what I need to do and where? Am I changing only the header.php?

Edited by MikiCatDesigns
Link to comment
Share on other sites

I'm sorry, I don't think I can really do that as the code you provided in your first post doesn't seem to be the complete page as when I view the source of the page there is a <style> section in the <head> of the document. There are other files included somewhere.

 

If you can locate that file, in the <style> section you would just need to add:

#header ul li a {color:red !important}

 

it doesn't have to be "red"...change to whatever color/html color code you want.

Link to comment
Share on other sites

That javascript file was the cause of your issues. If we were still in the 90s then that would be of been acceptable back then. Thankfully web technologies have moved on since. You should not have any problems replicating your current menu to be HTML and CSS based. I see no reason why you'd need javascript for it.

 

 

 

And each one of my items for sale has to have their own PHP file.

Why? PHP is a programming language - it shouldn't be used to serve only static content. If you want to use includes then use Server Side Includes.

 

All your products information should stored in a database. You'd ideally have one file called product.php which will fetch the product details from the database and then serve that information to the user. 

 

 

 

Can you give me a full example of what I need to do and where? Am I changing only the header.php?

How can we tell you what you need to do when we cant see your code.

Link to comment
Share on other sites

 

That javascript file was the cause of your issues. If we were still in the 90s then that would be of been acceptable back then. Thankfully web technologies have moved on since. You should not have any problems replicating your current menu to be HTML and CSS based. I see no reason why you'd need javascript for it.

I agree. It's some old code that I didn't write myself. The entire website was setup by a designer. Apparently not a very good one. I've been teaching myself HTML and some PHP to clean up some of the code and make it easier but it's an uphill battle. I'm still learning and know next to nothing about CSS. I'm still trying to figure out how to use Dreamweaver other than as a plain code editor.

 

I'm using eCommerce Template (the designer's choice not mine) and was told that if I wanted multiple pictures in multiple sizes for each item, I needed each item to have their own PHP file. I know there are other, easier ways to do this but this is how it was setup and I don't have the time, money or knowledge to change it. I'm only concerned now with getting the header to not only point to the correct file but also a submenu and color change on mouseover. The way it worked perfectly for years!

 

 

How can we tell you what you need to do when we cant see your code.

What portion of the code do you need? And can you tell me why it worked in the past and only recently stopped working? Also, why would it keep trying to point to the HTML file when it clearly links to the PHP file? This is what's confusing me completely. I'm at my wits end. If I could just fix the stupid header menu, I can live with the rest of the cumbersome stuff.

Link to comment
Share on other sites

I'm sorry, I don't think I can really do that as the code you provided in your first post doesn't seem to be the complete page as when I view the source of the page there is a <style> section in the <head> of the document. There are other files included somewhere.

 

If you can locate that file, in the <style> section you would just need to add:

#header ul li a {color:red !important}

 

it doesn't have to be "red"...change to whatever color/html color code you want.

 

The code I provided was from my header file. When you view the source code from the website, it includes everything from the header, index, leftsidebar and footer. So I don't know where the section needed is. I really don't want to have to change every document, hence wanting only one header file. There is this in the header file.

        <ul style="margin:0px;padding:0px;font:italic normal bold 14px Georgia,Times New Roman,Times,serif;">

Is that where I'd put the above? But at which point?

Link to comment
Share on other sites

  • Solution

 

 

Also, why would it keep trying to point to the HTML file when it clearly links to the PHP file? This is what's confusing me completely. I'm at my wits end. If I could just fix the stupid header menu, I can live with the rest of the cumbersome stuff.

Boompa, CroNiX and I have explained why.

 

it was the PLHIM.js javascript file overriding your links. That was cause of the problem! 

Link to comment
Share on other sites

OMG, that was it. The simple answer. I found the PLHIM.js file, edited it, put the script back into the header, and all is as it should be. I'm not sure why there was a problem in the first place with the problem of [an error occurred while processing this directive], but it is now resolved exactly as I would have wished.

 

I now know that I need to learn a lot more, and you all have been so, so helpful answering all my stupid questions. I think I'm going to continue on remaking my site with cleaner, more efficient code. I also just don't like it anymore.

 

As explanation for my stubborness, I was married to a software developer for over 12 years. He always commented his code, it was always clean and efficient and he removed extraneous and unnecessary code whenever he found it. I guess I got used to working with someone so efficient. I learned HTML under him and while I'm no programmer, I got into the same habits on the little I did do. Guess when I saw what this designer handed me, I got frustrated. I've been trying to redo it without reinventing the wheel but I think I'm just better off starting from scratch. I need to learn more about PHP and CSS though. Thanks to all of your patience and support, I want to and I will!

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.