RyanJ Posted September 13, 2013 Posted September 13, 2013 No matter what page I view, $page->id is returning the root id. Strangely enough though it returns the proper page $page->title, $page->name, $page->parent_id. If I echo $page->rootParent;, it returns the same id. Im baffled?
arjen Posted September 13, 2013 Posted September 13, 2013 What version are you running? Also does this happen on all levels - i.e. /level1/level2/level3?
RyanJ Posted September 13, 2013 Author Posted September 13, 2013 Hi arjen, I am running version 2.3 and yes it does happen on all levels.
interrobang Posted September 13, 2013 Posted September 13, 2013 Sounds strange. Maybe you have forgotten a = somewhere like this: if($page->id=1){} instead of if($page->id==1){} 3
RyanJ Posted September 13, 2013 Author Posted September 13, 2013 @interrobang. I retract my previous statement. You are correct as I was missing an =. Thank you for that because I would have probably just started everything all over since its a new site. I wont mention how long I have been trying to figure it out.I can now declare defeat by the = and take the idiot of the day award . I am taking this as a sign to take a break.
arjen Posted September 13, 2013 Posted September 13, 2013 Good thinking! Diogo teached me to turn them around. This way you notice the error more quickly. if(1 == $page->id) { // Do stuff } 3
RyanJ Posted September 13, 2013 Author Posted September 13, 2013 Thanks for the tip Arjen, I will have to keep that in mind. Thanks again Interrobang your my hero of the day. I would have never caught that.
Martijn Geerts Posted September 14, 2013 Posted September 14, 2013 I'm very picky here. When I can I compaire with === I prefer that. This will tell me that the types are the same to. 3
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now