Jump to content

Recommended Posts

Posted

I am embarrassed that I have to ask this question, but I cannot get my selector to work.  I want to output a list of players that are assigned to their specific team. Each Player has a team_name field which references their team as a page field select drop down. 

$players = $pages->find("template=player, team_name=$page->id");
   foreach ($players as $player) {
    echo "<li><a href='{$player->url}'>{$player->title}</a></li>";
   }

$page->id is referencing the team page. I have tried multiple variations using both find/get but I am missing something. Any kick in the head is appreciated. My structure is like so 

Players

 -- Player 1

Teams

-- Team 1

Posted (edited)

My selector worked all along. Thanks arjen for pointing out $page instead of $page->id, I was looking at teams that had no players assigned to them :-[ One of those days I guess. Please add this post to the wall of shame. DUH!

Edited by RJay
Posted

I am not sure what qualifies for the wall of shame (though I did not know one really existed). Maybe I should have stated how much time I spent searching the forum and trying to figure out what was wrong as well.

Posted

My selector worked all along. Thanks arjen for pointing out $page instead of $page->id, I was looking at teams that had no players assigned to them :-[ One of those days I guess. Please add this post to the wall of shame. DUH!

....That's why "if" is your good friend...if (teamHasplayers) {echo "bazinga!"}....

  • Like 1
Posted

Hello Guys,
 
i am confused about this and some other points... 
 
At first: the selectors (for page-type)
 
- produkte (products)
  - product 1 
  - product 2
 
- marken (brands)
  - Masita
  - Kempa 
 
- filter (filters)
  - geschlecht (gender)
     - Damen
     - Herren
     - unisex 
  - farben (colors)
     - Grün
     - Gelb
     - Blau
     - Rot
  - Größen (sizes)
     - s
     - m
     - xl

Each "product" has three filelds (type: "page")
 
1.) marke; childs from "/marken/"
2.) geschlecht; childs from "/filter/geschlecht"
3.) farbe; childs from "/filter/farben"
 
So this working.. that means the expected pages are returned.

geschlecht=Damen 
OR 
geschlecht=Damen|Herren 
OR 
farbe=Grün|Gelb

But...

marke=Masita // no Result
marke=Masita|Kempa // no Result

This works again

$brands = (title=Masita|Kempa)
marke=$brands

 
So what is the difference and which one is correct?

Second: Sanitizer and pageName

I have added a few lines to the configuration of the module "pagename". Especially for the German umlauts ("ö" > "oe"...). 
By Admin > /filter/groessen

Great.

 $sanitizer->pageName('Größen',true) > "grossen" 

Wrong.. should be "gr*oe*ssen".  What is the secret here?

Thank you.

adios, Stefan

 
 
 
Posted

Hi Stefan, about the Sanitizer & Pagename: have you simply added new lines with äöü? or did you change the default existing ones (that belong to a nordic language and translate ä = a, ö = o, ü = u)?

the other one I'm not sure, but I always use pagefields like that: marke.title=Masita|Kempa

Posted

Hallo Horst,

marke.title=Masita|Kempa
 
cool, thank you.
have you simply added new lines with äöü? or did you change the default existing ones (that belong to a nordic language and translate ä = a, ö = o, ü = u)?
changed it. But both ways results in the same behaviour.
 
ciao, Stefan
Posted

@stefan, Just wanted to mention that it's generally not a good practice to use the title for such things. 

marke=Masita|Kempa

May cause trouble depending where and how you use it. If for forms and filters you could just use id or name instead of titles.

marke=2133|2134

There's many ways to do this stuff and depends what you want/need.

//some form ...

$options = $pages->get("/marken/")->children();
$select = $modules->InputfieldSelect;
$select->attr("name", "marken");
foreach($options as $opt) $select->addOption($opt->id, $opt->title);
echo $select->render();

// and later maybe

$markenids = implode("|", $input->post->marken);
$products = $pages->find("template=product, marke=$markenids); // marke=1231|1231|1233
...

  • Like 1

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
×
×
  • Create New...