Then use is_page() ... http://codex.wordpress.org/Function_Reference/is_page
So it has the same effect as using a different template, but without the cluttering effect they have.
Then use is_page() ... http://codex.wordpress.org/Function_Reference/is_page
So it has the same effect as using a different template, but without the cluttering effect they have.
@itsananderson,
My include code was:
<?php
include(ABSPATH . 'resources/profile.php');
?>
@DD32,
Do you think it's an issue of it being a Page and not a Post or an archive that relies on Post information? If not, my brain tells me I'll experience the same result.
As far as I can tell, I"m using the same code I'm using on another site, obviously with a different database. It also, of course, has a different variable that I'm trying to use. I"m trying to pass the title of a Page so my code can use it to reference information from another data table within my WP database.
That's what my brain tells me. :)
Well, silly question here, but there IS a profile.php in that resources folder, right? If so, have you checked that it's permissions are such that it can be included?
I tried viewing http://spieceselect.org/resources/profile.php and got a not found error, which suggests to me that the file isn't there (could it be in a slightly different path?)
After looking at your website, I think everyone is right that the solution you're using isn't the best. I don't think a page template is the way to go though. You've got some fun AJAX stuff going on that wouldn't be helped at all by a page template. I think a much better choice would be to use a shortcode to get your data into the post. These are also not very hard to implement, and I imagine several people here (myself included) could help you with it.
In all the messing around with the INCLUDE, I did omit a level in the path. It should be:
http://spieceselect.org/resources/2011/profile.php
Of course I get the error:
Fatal error: Call to undefined function get_query_var() in /home/jwrbloom/public_html/spieceselect.org/resources/2011/profile.php on line 3
Ahh, so now what's probably happening is the eval'd code is running outside the context of the rest of the request (which makes sense I guess). If that's what happening, it means that none of the functions or variables that WordPress defines will be available.
Again, probably best to just use a Short Code here.
But this code is working on my production site. Same pathway within that site's URL /resources/wp-playerProfile.php. It's place via an INCLUDE on my theme's Tag Archive.
$wp_tagID = get_query_var('tag_id');
mysql_select_db("jwrbloom_wpHHR");
$query = 'SELECT * FROM wp_playerRank';
$results = mysql_query($query);
while($line = mysql_fetch_assoc($results)) {
The ABSPATH only gives me a much longer error, and I have used the HTTP in includes in multiple other locations successfully on my production site.
I don't care if it worked before... It's not going to work this time. Trust me, I do know what I'm talking about here. Including via HTTP doesn't include the code, it includes the output of the HTTP call, which is not code but the product of running that code. It's a bad idea and you should never, ever, include a URL.
The ABSPATH way is the *only* way you're going to make this work properly. So you have to solve any new problems using that way.
So if you get a new error, then give us that error. Just because the error is shorter doesn't make it a better error to have, you know...
Fair enough, and I found a mistake on my part in the path using the ABSPATH.
Here is the code I'm using. It's producing no errors now, but it is producing just the names of all the Pages, which I assume match the page_id. Instead, I just want it to produce the content that matches the applicable page.
<?php
$playerName = get_query_var('page_id');
$con = mysql_connect("localhost","jwrbloom_","redcoach");
mysql_select_db("jwrbloom_wpspselect", $con);
$query = 'SELECT * FROM team2011 ORDER BY uniform ASC';
$results = mysql_query($query);
while($line = mysql_fetch_assoc($results)) {
if ($playerName == $line['nameFirst'].'-'.$line['nameLast']) {
echo '<div>' . $line['nameFirst'].' '.$line['nameLast'] . '</div>';
}
}
?>
http://spieceselect.org
From there, looking at the thumbnails below the Featured panel, click on the third one from the left, top row. I want it to just produce one name in the smaller white font, below the school name and position. Eventually, once we get this figured out, the data I'll echo is the school's address and coach's name.