Why does this header cause a problem?

Posted on 2013-09-04
Medium Priority
Last Modified: 2013-09-05
Head out to http://www.countryshowdown.com/app/view_contestants.php?id=58382. No biggie, just the mobile version of the countryshowdown.com page.

I've got dilemma, however, and I'm at a loss as to why it's happening.

I need to swap out the header on this page with something else that will allow for a little drop down animation that alerts the user to the possibility of adding the page to their mobile device as an icon. The script works great and I can put it in the header where it belongs without any issue, but...

I don't want this script to run on any other page beside the view_contestants.php page. Yet, when I change the code from require_once('header.php') to require_once('header_script.php') only a portion of the page is shown and I don't understand why or how to fix it.

For the sake of trying to eliminate problems, I kept the two files - header.php and header_script.php exactly the same. But when you go to  http://www.countryshowdown.com/app/view_contestants_1.php?id=58382, you'll see that only half the content is displayed. Why and how do I fix it?
Question by:brucegust
  • 4
  • 2
LVL 84

Accepted Solution

Dave Baldwin earned 1000 total points
ID: 39466246
bruce!! Do you ever look at the source code in your browser?  To see things like the fact that the second version is trying to include a second page in the page??  I mean, that's one of the first things we do to try to help you.

Author Comment

ID: 39466516
Yes, I do look at the source code...

And I was kind of hoping you could tell me why there's a repetition. Lines 1-275 are repeated. Yet the only difference in the two pages is in one instance I'm calling require once('header.php') and the other page I'm saying require('header_script.php') and both header.php and header_script.php are identical. So why the repetition?

And just for grins, in case I'm missing something obvious, here are the two "headers:"

Author Comment

ID: 39466521
Here's the other header. Same script, just a different name, but for some reason I'm getting a bunch of redundancy.
Easily Design & Build Your Next Website

Squarespace’s all-in-one platform gives you everything you need to express yourself creatively online, whether it is with a domain, website, or online store. Get started with your free trial today, and when ready, take 10% off your first purchase with offer code 'EXPERTS'.

LVL 45

Assisted Solution

by:Chris Stanyon
Chris Stanyon earned 1000 total points
ID: 39466859
OK. So the headers includes are the same, which means that your 2 pages that are including them are not: Can you post the code for view_contestants_1.php and view_contestants.php.

Author Comment

ID: 39466980
So I figured before I posted the files, I would go thru, just to make sure, that I wasn't overlooking something ridiculously simple. I mean, I do not recall coding two instances of headers. Why would I be appealing to the experts for something so outrageously simplistic?

Line 6 - there it was: require_once('header.php'); in addition to the other require_once('header_script.php)

I'm an idiot, but I'm a hardworking idiot...


Author Comment

ID: 39466991
As an aside, it just dawned on me why this was so illusive.

This particular app was outsourced and while I wrote most of the code, the subcontractor (who did a great job) began by copying and pasting my code as a starting point and then changing things as they needed to be altered for the sake of the mobile version that he was responsible for.

He had two instances of require_once('header.php') listed, but it wasn't a problem because it was the same header and line 102 didn't trigger anything because it was identical to line 4.

Here I come several weeks later and make some changes, oblivious to the redundancy and my attempts to troubleshoot begin with something complicated rather than something easy. In other words, I'm looking at replacing the engine rather than beginning by seeing if there's gas in the tank.

Thanks for the other set of eyes...
LVL 45

Expert Comment

by:Chris Stanyon
ID: 39466996
Don't feel bad. I've been there and sometimes just explaining the problem to others can help you see it, particularly when it's so obvious - pleased you got it working :)

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
The title says it all. Writing any type of PHP Application or API code that provides high throughput, while under a heavy load, seems to be an arcane art form (Black Magic). This article aims to provide some general guidelines for producing this typ…
In this tutorial viewers will learn how to style rounded corners for elements in CSS using the border-radius property Begin with a normal styled element such as a div: To style all four corners of the div to be the same degree of roundness, use the …
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…

621 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question