Avatar of Bruce Gust
Bruce GustFlag for United States of America

asked on 

Why does this header cause a problem?

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?
PHPCSS

Avatar of undefined
Last Comment
Chris Stanyon
ASKER CERTIFIED SOLUTION
Avatar of Dave Baldwin
Dave Baldwin
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of Bruce Gust
Bruce Gust
Flag of United States of America image

ASKER

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:"
header.php
Avatar of Bruce Gust
Bruce Gust
Flag of United States of America image

ASKER

Here's the other header. Same script, just a different name, but for some reason I'm getting a bunch of redundancy.
header-script.php
SOLUTION
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
Avatar of Bruce Gust
Bruce Gust
Flag of United States of America image

ASKER

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...

Thanks.
Avatar of Bruce Gust
Bruce Gust
Flag of United States of America image

ASKER

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...
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 :)
PHP
PHP

PHP is a widely-used server-side scripting language especially suited for web development, powering tens of millions of sites from Facebook to personal WordPress blogs. PHP is often paired with the MySQL relational database, but includes support for most other mainstream databases. By utilizing different Server APIs, PHP can work on many different web servers as a server-side scripting language.

125K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo