Search

My homepage page has a DS that pulls a lot of data.

www.foo.com (returns data for homepage)

I also use a parameter for a DS to pull data to display a single entry, like this:

www.foo.com/entry-handle (returns data for the single entry and for homepage)

I can make the www.foo.com page output an empty result for the entry DS, but I can’t find a way to give the hompage DS an empty parameter so it doesn’t give results for the single entry page.

Is there a way to maybe add an empty parameter for the entry page, but still give a value on the parent page? I’d like to streamline my DSs.

Thanks!

Add entry-handle as a Required URL Parameter in your DS so that if it resolves to nothing, an empty result will be returned.

Alternatively you can use the slightly more hacky:

{$entry-handle:0}

if the param cannot be resolved on the homepage the fallback value of “0” is used. As long as you haven’t got any entries with a title of 0 none will be returned.

I know how the entry handle gives empty results on the entry page, I need the opposite. I need empty results when the handle has a value so my homepage data doesn’t pull on the entry page.

Could you add a bogus filter to your homepage DS that uses $entry-handle? This way, when $entry-handle is not set, it’ll ignore the filter, and when it is set, the homepage DS will return no matches? Unfortunately, it’ll still run queries, but at least it won’t build the XML…

Wait, I think I stated my intent wrong before.

I know if the entry handle is null, I won’t get results on the homepage for entries.

I need to find a way to keep the homepage DS from returning data on the entry page. The homepage doesn’t have a handle.

Does that make more sense?

Can I do something like if {$current-page!=’home’} return an empty result?

Ok, let me get this straight. You have one Symphony Page, with both a homepage ds and an entry ds.

Case 1

When no $entry-title is provided, the entry ds should not return anything and the homepage ds should return results.

Case 2

When $entry-title is provided by the URL, the entry ds should return an entry, and the homepage ds should, ideally, not return anything.

Is that correct? If so, I think the solution I offered above should work. You add a filter to your homepage ds that filters a random field by the value of $entry-title. This way, in case 1, when $entry-title is not set, your homepage ds will ignore that filter and return normal results. But in case 2, when $entry-title is set, the homepage ds will attempt to filter its results using the $entry-title and come up empty. No?

What you could do is use my extension for front page params, then add a new page (entry), make that return the desired xml, choose that page for front params, and you’re done!

It would do the following:

www.domain.com -> home
www.domain.com/param -> entry

Hope that helps!

Thanks for the help. I’ll try some more once I get some free time.

Unfortunately, it’ll still run queries, but at least it won’t build the XML…

So even if I did get this to work, the DS will still get the results, just not build the XML? Maybe creating another page would be better. URLs wouldn’t be as short, but it wouldn’t hit the database so hard.

Maybe creating another page would be better. URLs wouldn’t be as short

Well, the url could be the same, if you use my extension.. If you need help, let me know!

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details