Jump to content

Search and pages without tpl files


iNoize
 Share

Recommended Posts

Hello, 

I need some advice how to solve the problem.  I try to use the search function and need to choose between normal pages and pages without tpl files. 

i have found this post from Soma how can i change the output for me  ? 

https://processwire.com/talk/topic/1746-dont-show-pages-without-template-file/?p=16309

if tpl nofile_ then show url from parent 

if tpl show normal link 

	if($matches->count) {
			// we found matches
			echo "<h4>Es wurden $matches->count Ergebniss(e) gefunden:</h4>";
			// output navigation for them (see TIP below)
			echo "<ul class='nav'>";
			$tmpls = $templates->find("name^=nofile_");
                        foreach($matches as $match) {
				echo "<li><a href='$match->url'>$match->title</a>";
				echo "<div class='summary'>$match->summary</div>$match->template </li>";
			}
                        echo "</ul>";
			// TIP: you could replace everything from the <ul class='nav'> above
			// all the way to here, with just this: renderNav($matches); 

		} else {
			// we didn't find any
			echo "<h3>leider wurden keine Ergebnisse gefunden</h3>";
		}

tnx

Link to comment
Share on other sites


if($matches->count) {

// we found matches

echo "<h4>Es wurden $matches->count Ergebniss(e) gefunden:</h4>";

// output navigation for them (see TIP below)

echo "<ul class='nav'>";

$tmpls = $templates->find("name^=nofile_");

foreach($matches as $match) {

if($tmpls->has($match->template)){ // Matches template

echo "<li><a href='$match->url'>$match->title</a>";

echo "<div class='summary'>$match->summary</div>$match->template </li>";

}else{ // Not matched

echo "<li><a href='$match->url'>$match->title</a>";

echo "<div class='summary'>$match->summary</div>$match->template </li>";

}

}

echo "</ul>";

// TIP: you could replace everything from the <ul class='nav'> above

// all the way to here, with just this: renderNav($matches);

} else {

// we didn't find any

echo "<h3>leider wurden keine Ergebnisse gefunden</h3>";

}

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

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...