Search the Community
Showing results for tags 'selector string'.
-
Hi I have a number of pages with images and I'm having a problem selecting on the image descriptions. In the code snippet below, the I added images.description field to my selector and it does work in that I get the expected no. of matches. So findTag gets me a list of images matching the tags in the code, but if I swap that line for the commented line $match->images->find it does not work giving 0 results. There is findTag for tags but for description there is not a dedicated function, so I should use find. But what selector will give me a list of images matched by image description? Many thanks. if($q !== '') { $keywords = $sanitizer->selectorValue($q); $matches = $pages->find("template=album, title|summary|images.tags|images.description~=$keywords"); echo "<p>match count: $matches->count</p>"; foreach($matches as $match){ echo "<p>{$match->title}</p>"; $i = $match->images->findTag($keywords); //$i = $match->images->find("template=album, images.description~=$keywords"); GIVES ZERO MATCHES $j = count($i); echo "<p>No. of image matching: $j</p>"; foreach($i as $img){ echo "<img src='{$img->url}' alt='{$img->description}'>"; } } }
- 2 replies
-
- selector string
- image tag
-
(and 2 more)
Tagged with:
-
Hello, I'm facing an issue trying to restrict access to a field so front-end edition is possible in an easy manner for the user. Let me explain : I have a field 'group' which is a Page list of group names. I want the user to be able to front-end edit a 'player' page in which this group field appears. I'd like the user to have a list of groups limited to his or her own groups (so he or she doesn't see all groups created by other users). In the back-end, I use this selector string : template=group, created_users_id=[user], sort=title This works great ! BUT here's my issue : If I back-end edit a 'player' page as 'Admin', the 'group' is empty (since admin is not the created-users-id and the group field is then empty... In other words, I must choose between all groups shown to all users (which may be scary for a user having only 2 or 3 groups whena list of 60 shows up) OR having a correct list for the front-end user, but empty for the back-end 'admin'. Can anyone think of another way I could get the expected result ? I have a feeling the simplest way would be to have a "Ignore for superusers" checkbox next to the 'selector string'. Thanks !
- 2 replies
-
- restrict
- selector string
-
(and 1 more)
Tagged with: