Jump to content

page reference field


rareyush
 Share

Recommended Posts

I added a field type 'page reference' using checkboxes knows as services.

now i want to display the pages according to service.

I can display all services list but when i click on any services then I can see whole code of site 

 

any idea where i am wrong

?

main 
	cate1
		subcate1
		subcate2
	cate2
		subcate1
		subcate2
services
	first-service
	second services

	

 

 

these services is being used as a page reference  in subcate1, subcate2 templates.

 

and in the navbar when i click on services and then when i click on any of the following service then i can see whole source code of my site.

Link to comment
Share on other sites

42 minutes ago, neosin said:

can you post  template code?

subcate template code

<?php namespace ProcessWire;


 $ser="";
$title= $page->title;
$services = $page->get('services');
$brief= $page->brief;
  
  if($page->services) {
 foreach($page->services as $p) {
   $ser.= "<br><p>{$p->title}</p>";
 }
}

echo "
<div style='margin-top: 100px;'>
$title <br>
$ser
</div>
";
?>

 

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...