Beginner Help Urgently Needed
Moderator: General Moderators
Beginner Help Urgently Needed
OK. I inherited some PHP script code, but I seem to have messed something up. I can't seem to figure out how to fix.
So it appears to be missing "portfolio.php" between the last "/" and the "?" I would have thought this would have been easy to spot and fix, but I just cannot figure it out.
Any help would be gratefully received.
So it appears to be missing "portfolio.php" between the last "/" and the "?" I would have thought this would have been easy to spot and fix, but I just cannot figure it out.
Any help would be gratefully received.
Last edited by stub on Sat Mar 05, 2011 6:56 am, edited 1 time in total.
-
Peter Kelly
- Forum Contributor
- Posts: 143
- Joined: Fri Jan 14, 2011 5:33 pm
- Location: England
- Contact:
Re: Beginner Help Urgently Needed
For starters your going to have to show us your code as we cant help if we cant see.
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
Re: Beginner Help Urgently Needed
Please use descriptive titles, and avoid the usage of words like "Urgent", since we treat all threads here with equal priority (yours is no different).
Thanks.
Thanks.
Re: Beginner Help Urgently Needed
OK. Here's the code for the working website
And here's the code for the non-working website
And here's the code for the non-working website
Last edited by stub on Sat Mar 05, 2011 6:47 am, edited 3 times in total.
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
Re: Beginner Help Urgently Needed
We need to see the PHP code, not the html.
And please only post the relevant code (or what you think it may be).. posting entire large scripts is difficult to follow.
EDIT | You updated your code, cool.
And please only post the relevant code (or what you think it may be).. posting entire large scripts is difficult to follow.
EDIT | You updated your code, cool.
Re: Beginner Help Urgently Needed
OK I fixed the code in the time it took you to write your message, as I realized I'd posted the wrong code. See corrected code above. I have no idea where the problem is except that it's to do with the linking to the Categories, as I posted in my introductory message.
- Jonah Bron
- DevNet Master
- Posts: 2764
- Joined: Thu Mar 15, 2007 6:28 pm
- Location: Redding, California
Re: Beginner Help Urgently Needed
Here's the diff.
-- removed upon request --
As you can see, the only change that's not a comment is line 95. I suggest you revert the change and see what happens.
-- removed upon request --
As you can see, the only change that's not a comment is line 95. I suggest you revert the change and see what happens.
Last edited by Jonah Bron on Sun Mar 06, 2011 9:33 pm, edited 1 time in total.
Re: Beginner Help Urgently Needed
I tried that. But it didn't work. It would only show the index page. I had to revert back to show the portfolio page. So does that suggest the problem lies within the included $template/portfolio.php, compared to the original $template.index.php (which are mostly html code). Should I post those files instead?
What I actually did was to move the Categories away from the index page and to show them only on the (new) portfolio page. I did this by copying the index.php in both the main main folder and in the templates folder to a portfolio.php in these folders. Then I removed any reference to categories in the index files. I'm pretty sure I had this working at some point. But now the non-working page isn't showing the portfolio.php between the "/" and the "?". I'm pretty sure this is where the problem lies. But don't see why it is happening.
What I actually did was to move the Categories away from the index page and to show them only on the (new) portfolio page. I did this by copying the index.php in both the main main folder and in the templates folder to a portfolio.php in these folders. Then I removed any reference to categories in the index files. I'm pretty sure I had this working at some point. But now the non-working page isn't showing the portfolio.php between the "/" and the "?". I'm pretty sure this is where the problem lies. But don't see why it is happening.
- Jonah Bron
- DevNet Master
- Posts: 2764
- Joined: Thu Mar 15, 2007 6:28 pm
- Location: Redding, California
Re: Beginner Help Urgently Needed
Is error reporting enabled? If not, enable it. That may help pin down the problem.
Re: Beginner Help Urgently Needed
The problem is, it's not reporting an error, it's serving up the index page.
It appears to be missing "portfolio.php" between the last "/" and the "?" I would have thought this would have been easy to spot and fix, but I just cannot figure it out.
Last edited by stub on Sat Mar 05, 2011 6:54 am, edited 1 time in total.
-
Peter Kelly
- Forum Contributor
- Posts: 143
- Joined: Fri Jan 14, 2011 5:33 pm
- Location: England
- Contact:
Re: Beginner Help Urgently Needed
Try change
to
P.S if this is wrong I'm sorry currently in work only able to glance.
Code: Select all
$catidsort = (!is_null($catid) ? "&cat=$catid" : '');Code: Select all
$catidsort = (!is_null($catid) ? "portfolio.php&cat=$catid" : '');Re: Beginner Help Urgently Needed
Nope that didn't work.
Now this is the same as the source code when I view the source code for the original code. But I need "./?cat=1" to be reading "./portfolio.php?cat=1". Since we have already eliminated the source code in /portfolio/portfolio.php (we've seen it's the same code) it must be in the template file /portfolio/templates/default/portfolio.php, or a setting for the root directory somewhere? Yes/No?
I've just noticed something about the original code. the line quoted above shows exactly what I want "./portfolio/portfolio.php?cat=1" when hovered over in firefox. So I think this line (quoted above) should be and is the same in both, and it's just a directory setting problem (maybe). And so the question is, why doesn't the updated code show the complete link and how to fix it? I still think this is a simple fix, but I just cannot figure it out for myself (yet).
The strange thing is, I'm sure I had this working at some point.
Now this is the same as the source code when I view the source code for the original code. But I need "./?cat=1" to be reading "./portfolio.php?cat=1". Since we have already eliminated the source code in /portfolio/portfolio.php (we've seen it's the same code) it must be in the template file /portfolio/templates/default/portfolio.php, or a setting for the root directory somewhere? Yes/No?
I've just noticed something about the original code. the line quoted above shows exactly what I want "./portfolio/portfolio.php?cat=1" when hovered over in firefox. So I think this line (quoted above) should be and is the same in both, and it's just a directory setting problem (maybe). And so the question is, why doesn't the updated code show the complete link and how to fix it? I still think this is a simple fix, but I just cannot figure it out for myself (yet).
The strange thing is, I'm sure I had this working at some point.
Last edited by stub on Sat Mar 05, 2011 6:52 am, edited 2 times in total.
Re: Beginner Help Urgently Needed
OK. I think I've found the errant line of code.
Last edited by stub on Sat Mar 05, 2011 6:59 am, edited 2 times in total.
Re: Beginner Help Urgently Needed
OK. I fixed it. It was in the functions.php file in the /includes directory, Added the "portfolio.php" there.
I would be grateful if Jonah could delete the code he quoted when comparing the two files. Thank you.$listhtml .= "<li$class><a href=\"./portfolio.php?cat=$cat[catid]\" title=\"$cat[description]\">$cat[title]</a> ($cat[numdomains])</li>\n";