We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Playa

Development and Programming

Matt Weinberg's avatar
Matt Weinberg
489 posts
16 years ago
Matt Weinberg's avatar Matt Weinberg

Have you considered using PHP to do a live count, and just outputting the special formatting conditionally when the count only == 1?

       
Paramore's avatar
Paramore
40 posts
16 years ago
Paramore's avatar Paramore

Yes. 😊

I just wanted to see if I could get this working with native EE because things generally work better (in my opinion, at least).

– Sean

       
Ryan M.'s avatar
Ryan M.
1,511 posts
16 years ago
Ryan M.'s avatar Ryan M.

I was having this discussion with someone the other day, about enabling PHP on templates to do what you need to do. You almost get the idea you can’t do it - or shouldn’t do it - on an EE template. That’s bogus, of course, and I find that in many cases, it’s essential to do something with PHP!

       
Matt Weinberg's avatar
Matt Weinberg
489 posts
16 years ago
Matt Weinberg's avatar Matt Weinberg

I don’t have nearly the EE experience of many on this board (including yourself, Ryan), but I agree. I find PHP in templates to be both completely essential when something isn’t built into an EE function, and one of the most powerful and compelling features of EE.

       
Paramore's avatar
Paramore
40 posts
16 years ago
Paramore's avatar Paramore

Well, I’ve found the problem:

Here is part of the print out for the template object $TMPL:

[related_markers] => Array
        (
            [0] => doc_services" limit="1
            [1] => doc_services
            [2] => doc_locations
            [3] => doc_locations
        )

Any thoughts on how to fix the field name regular expression? I’m not sure where to go from here, but will trudge on.

Thanks! Sean

       
Paramore's avatar
Paramore
40 posts
16 years ago
Paramore's avatar Paramore

Is it possible that this is a bug in EE? Because the $TMPL is parsing the template, and this extension is merely using that parsing, correct?

– Sean

       
Paramore's avatar
Paramore
40 posts
16 years ago
Paramore's avatar Paramore
[var_single] => Array
        (
            [title] => title
            [doc_display_name] => doc_display_name
            [doc_title] => doc_title
            [service_display_name] => service_display_name
            [location_display_name] => location_display_name
            [doc_services" limit="1] => doc_services" limit="1
            [doc_services] => doc_services
            [doc_locations] => doc_locations
        )

… looks broken also.

       
Paramore's avatar
Paramore
40 posts
16 years ago
Paramore's avatar Paramore

Looking at the regex for the {related_entries} tag:

preg_match_all("/".LD."related_entries\s+id\s*=\s*[\"\'](.+?)[\"\']".RD.
"(.+?)".LD.SLASH."related_entries".RD."/is", $chunk, $matches)

As I read this I see the regular expression is missing the extra attributes of the tag, like limit=”” and offset=”“. So, this is on purpose? There is no ability to do a limit or an offset? Is this by design?

Any answers would be appreciated.

Thanks! Sean

       
Matt Weinberg's avatar
Matt Weinberg
489 posts
16 years ago
Matt Weinberg's avatar Matt Weinberg

Don’t forget that the related_entries tag is designed to show only one entry…Playa and Multi-Relation are just extensions that extend the functionality. A tag that’s only made to show one entry has no use for limit and offset.

       
Paramore's avatar
Paramore
40 posts
16 years ago
Paramore's avatar Paramore

Okay, that makes sense now. Hopefully in EE 2.0 there will be the ability to do this natively.

My workaround does involve PHP: I simply created a count, tested for the first value, then incremented the value. Simple stuff, but would be “cleaner” if it were all EE. 😊

Thanks! Sean

       
stinhambo's avatar
stinhambo
1,268 posts
16 years ago
stinhambo's avatar stinhambo

Hi all,

I am using some code to pull out entry_ids using Playa. Now I thought that it would pull them out in the order I set them in Playa but instead it is pulling them out in order of entry_id.

Here is my code -

{embed="includes/exhibitions_selected_works_item" gallery_id="0{related_entries id="exhibitions_related_artist"}|{entry_id}{/related_entries}"}

which embeds this -

{exp:weblog:entries entry_id="{embed:gallery_id}" dynamic="off" disable="categories|member_data|trackbacks"}
etc etc

It is throwing out the following (test output)

William Zorach - 298
Robert Motherwell - 234
Michael Goldberg - 158
Giorgio Cavallon - 125
Albert Bloch - 87
Emil James Bisttram - 86
Romare Bearden - 78
Hans Hofmann - 53

Which is different to the order I have set in Playa.

       
Luke Hardiman's avatar
Luke Hardiman
109 posts
16 years ago
Luke Hardiman's avatar Luke Hardiman

I’m having some trouble with some related entries not showing up. When I output my playa field I am getting some kind of database table reference in square brackets, followed by the title of the related entry.

The numbers preceded by an exclamation mark are not showing. Can anybody please tell me what the exclamation mark refers to, as it seems that getting rid of this is the answer to my problems.

The format of the non-displaying related entries is this: [!1234] Entry Title

Ones that look like this are successfully outputted by the related_entries loop: [1234] Entry Title

       
lukemcr's avatar
lukemcr
154 posts
16 years ago
lukemcr's avatar lukemcr

Hm… Any answer to stinhambo’s question above? I’m running in to the same problem.

       
stinhambo's avatar
stinhambo
1,268 posts
16 years ago
stinhambo's avatar stinhambo

I’m waiting to see if Playa can allow custom status. I am stuck on a project now!

       
stinhambo's avatar
stinhambo
1,268 posts
16 years ago
stinhambo's avatar stinhambo

Ok I have a solution for the custom status thing but it’s not quite as refined as you might want. Basically it allows you to assign any entry as long as it’s not closed.

Find the code below in the ext.playa.php file (Do a search for ‘status’ and it should be the first thing you find -

// --------------------------------
//  Assemble Rel Reference
//   - returns "[1234] Child Title"
// --------------------------------

Look out for this line -

$closed = ($status AND $status != 'open') ? '!' : '';

and change it to -

$closed = ($status AND $status == 'closed') ? '!' : '';

In the control panel, the entry you choose will still turn grey but it will be available to view in the template!

Be sure to only use the default status group (I’m not sure if this is importnat but I am as I don’t have time to test) and remember Playa will now consider all Status options except for Closed.

       
First 9 10 11 12 13 Last

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.