Page 1 of 1
Beginner Help Urgently Needed
Posted: Tue Mar 01, 2011 2:29 am
by stub
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.
Re: Beginner Help Urgently Needed
Posted: Tue Mar 01, 2011 9:02 am
by Peter Kelly
For starters your going to have to show us your code as we cant help if we cant see.
Re: Beginner Help Urgently Needed
Posted: Tue Mar 01, 2011 9:45 am
by John Cartwright
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.
Re: Beginner Help Urgently Needed
Posted: Tue Mar 01, 2011 10:14 am
by stub
OK. Here's the code for the working website
And here's the code for the non-working website
Re: Beginner Help Urgently Needed
Posted: Tue Mar 01, 2011 10:20 am
by John Cartwright
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.
Re: Beginner Help Urgently Needed
Posted: Tue Mar 01, 2011 10:25 am
by stub
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.
Re: Beginner Help Urgently Needed
Posted: Tue Mar 01, 2011 11:42 am
by Jonah Bron
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.
Re: Beginner Help Urgently Needed
Posted: Tue Mar 01, 2011 12:56 pm
by stub
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.
Re: Beginner Help Urgently Needed
Posted: Tue Mar 01, 2011 1:04 pm
by Jonah Bron
Is error reporting enabled? If not, enable it. That may help pin down the problem.
Re: Beginner Help Urgently Needed
Posted: Tue Mar 01, 2011 4:02 pm
by stub
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.
Re: Beginner Help Urgently Needed
Posted: Wed Mar 02, 2011 3:45 am
by Peter Kelly
Try change
Code: Select all
$catidsort = (!is_null($catid) ? "&cat=$catid" : '');
to
Code: Select all
$catidsort = (!is_null($catid) ? "portfolio.php&cat=$catid" : '');
P.S if this is wrong I'm sorry currently in work only able to glance.
Re: Beginner Help Urgently Needed
Posted: Wed Mar 02, 2011 4:12 pm
by stub
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.
Re: Beginner Help Urgently Needed
Posted: Sat Mar 05, 2011 2:25 am
by stub
OK. I think I've found the errant line of code.
Re: Beginner Help Urgently Needed
Posted: Sat Mar 05, 2011 6:11 am
by stub
OK. I fixed it. It was in the functions.php file in the /includes directory, Added the "portfolio.php" there.
$listhtml .= "<li$class><a href=\"./portfolio.php?cat=$cat[catid]\" title=\"$cat[description]\">$cat[title]</a> ($cat[numdomains])</li>\n";
I would be grateful if Jonah could delete the code he quoted when comparing the two files. Thank you.