noussh Posted June 18, 2014 Posted June 18, 2014 Hi everyone! I am very new to processwire. I have properties listed on a page. When I click on a particular property, it should take me to a single page where it show all the details. For example. : properties/ (shows all properties, i got this right.) properties/al-bateen-residences/ (shows al-bateen-residence detaisl) <?php $properties = $pages->find('template=properties'); ?> <?php foreach($properties as $property): ?> <div> <a href="<?=$property->url;?>"> <?=$property->title;?> </a> </div> <?php endforeach; ?> Thanks. noussh
arjen Posted June 18, 2014 Posted June 18, 2014 You should echo your properties. I would code it like this: <?php $properties = $pages->find("template=properties"); foreach ($properties as $property) { echo "<div><a href='{$property->url}'>{$property->title}</a></div>"; }
noussh Posted June 18, 2014 Author Posted June 18, 2014 Thanks Arjen, But my original question is unanswered. The code above show all properties, when I click on properties link, I should go to that specific page. How do we do that? Thanks.
Jan Romero Posted June 18, 2014 Posted June 18, 2014 The links you generated with <a href="<?=$property->url;?>"> don't go there? Where do they go then? Does the template "properties" have a php file associated with it? That's where you would echo the details using something like echo $page->myDetail;. 2
noussh Posted June 18, 2014 Author Posted June 18, 2014 @Jan Romero, Yes, now it works. I was trying to get url segmet to $page->get('path=urlsegment'). Thank you.
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