OllieMackJames Posted December 5, 2014 Share Posted December 5, 2014 in one template I use the page input field to get a link to another page on the site. foreach($slides as $slide){ $out .="<li>"; // Check for an image if($slide->slide_image){ $out .="<a href='{$slide->slide_link_url}'><img src='{$slide->slide_image->url}'></a>"; } // endif // put the caption together from the title and textarea in the repeater $out .="<div class='orbit-caption'>"; $out .="<a href='{$slide->slide_link_url}'><h3>{$slide->title}</h3></a>"; $out .="<a href='{$slide->slide_link_url}'><p>{$slide->basic_textarea}</p></a>"; $out .="</div>"; $out .="</li>"; } So I have a field called: slide_link_url Details tab: Single page (Page) or empty page (NullPage) when none selected Input tab: select parent root Label field: name Input field type: PageListSelect+ Now in the output I see a link to /1006 which throws an 404 error How can I get this to link to /name-of-page/ Hope this is clear enough, thanks! Link to comment Share on other sites More sharing options...
adrian Posted December 5, 2014 Share Posted December 5, 2014 You need to get the URL from the field: $slide->slide_link_url->url; But to make things a little less confusing, I would rename your field from slide_link_url to slide_page or something like that By the way - I am not sure why this is in the Profields board - do you mind if I move it to general support or API? PS Soma - I edited my mistake before your reply came through - wasn't trying to hide my initial mess 1 Link to comment Share on other sites More sharing options...
Soma Posted December 5, 2014 Share Posted December 5, 2014 You miss the ->url. You don't have to get the page like Adrian example as you already got the page. 1 Link to comment Share on other sites More sharing options...
OllieMackJames Posted December 5, 2014 Author Share Posted December 5, 2014 adria, it is in this board, because if I am correct the page field option only exists with Profields, anyways, fine by me to move to a place where more people can benefit. Link to comment Share on other sites More sharing options...
adrian Posted December 5, 2014 Share Posted December 5, 2014 adria, it is in this board, because if I am correct the page field option only exists with Profields, anyways, fine by me to move to a place where more people can benefit. Page fields are about as core as anything in PW. PW without free Page fields would be unspeakable 2 Link to comment Share on other sites More sharing options...
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