Jump to content

trouble with selector


bwakad
 Share

Recommended Posts

I am having trouble with a selector. In a normal way I would know the "country-name" and "province-name". So this would work:

foreach ($pages->get('/personal-info/countries/country-name/province-name/')->children as $child) {

But I only know the "province-name" for example "Drenthe". parent="/drenthe/" does not work, how do I get to those children?

Tree:

- home

-- personal-info

--- countries

---- NL

----- Drenthe

------ child

------ child

Link to comment
Share on other sites

Not really because children are nested inside each parent:

Tree:

- home

- personal-info

-- countries

--- NL >>>>>>>>>>>>>>>>>>>>>>>>> same level parents DE || FR || etc.

---- Drenthe

----- child

----- child

First I was thinking of a template for each country, but that would still leave me with a problem: NOT knowing the country name. The only thing I know IS the province name "drenthe".

Link to comment
Share on other sites

But somehow I got the impression this is all too complicated. I guess you are trying to list cities (children of provinces), right? Why not give them city templates and query for these? Other question: from which part of your tree are you searching from, meaning: how close to the desired pages are you when firing this query?

Link to comment
Share on other sites

to answer first question:

Maybe I should do it like this...

country-template = for country names

province-template = for province names

city-template = for city names

I could probably query for : "template=province, name=drenthe" fetch children. Even though the province-template holds more names from other countries.

your second question:

I use it to fill a select by the parent/child name - in this case "drenthe". Path from root is: /personal-info/countries/nl/drenthe/. So I am on any level...

It's just that I do not know the /nl/ part. It could be fr, de, etc.

Link to comment
Share on other sites

Dang! and I just made and assigned the templates. Which also work fine.

Anyway, thanks Soma (new title for you > life-saver) :rolleyes:

I do have a question, because my posts (eventually lead to the same thing) but are scattered so much.

I have the topics:

"states and cities",

"select - then auto values",

and this one "trouble with selector".

Is it possible to merge them and call it "Cascading / Dynamic Selects front-end". or something similar...

The cascading is working between 3 selects, and only need to fine tune some parts...

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...