Jump to content

Finding pages where the title contains a certain string


joe_ma
 Share

Recommended Posts

Hi

How can I seperate pages whose title contains a certain string from an array of pages?

So with

$results = $pages->find("template=template_name");

I get an array of all the pages.

Now I should like to extract only the pages that contain the string 'Nr. 7' in the title.

How can I do this?

Is there a direct way with strpos()?

EDIT:

Found the solution:

$tickets = array();
foreach ($results as $result){
		if (strpos($result->title, 'Nr. 7') !== false){
			$tickets[] = $result;
		}
	}

 

Edited by joe_ma
Problem solved
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...