Search

When I use numbers inside the reflectionfield I can not sort them right..

They are stored as varchar in the database, like a Text Input field, so will be sorted as plain text and not numbers. So 1, 2, 10, 12, 20 will actually be sorted as 1, 10, 12, 2, 20. The other option is to sort them in your XSLT:

<xsl:sort select="element" data-type="number" />

Is it possible to do maths on values in this field?? Say

{entry/number-1} + {entry/number-2}

designermonkey, yes:

{sum(number(entry/number-1), number(entry/sumber-2))}

nickdunn wrote about it earlier in this thread.

@nickdunn, okey, that's a solution.

When I have about 200 entries, symphony has to load all the entries, I only have to display 3 of them.

I'm using the Reflection Field to calculate how much page-views, votes and comments a terrace has.
To sort these fields, I found a way that works (for now). I putted three zero's 000 in front of the numbers, so symphony now sorts the entries properly, for example 000231, 00032, 00030, 00010 is sorted well.

I'm using the "Increment Number" extension so that the field of the page-views automatically updates itself every time a terrace is shown.

The Reflection Field doesn't update itself, so I have to do it manually, not a ideal solution in my opinion.

Is there a way to update the entry or the field automatically?

Is there a way to update the entry or the field automatically?

No. The entry that the reflection field originates from must be saved.

The Reflection Field doesn't update itself, so I have to do it manually, not a ideal solution in my opinion.

I think the problem may lie with how you have set up your sections and fields. If you create a specific thread, we can help suggest alternatives. It doesn't sound like the reflection field is what you are looking for.

Is there an easy way to update the stored values of this field?

I've got a section with 400+ entries where I'd like to add a reflection field - it's not true that I'll have to save all these entries manually to get an output for this field at all, isn't it?

it's not true that I'll have to save all these entries manually to get an output for this field at all, isn't it?

Unfortunately it is — the extension relies on the EntryPostEdit delegate to do its thing. You could potentially write a short script which uses the EntryManager class to grab your entries, loops over each and calls the compile() method on the Reflection field (which builds XML, runs XPath and updates the field's value).

Damn ...

I have been musing about how I can store order details with calculated prices and discount etc, and I'm hoping this field is the right answer...

(Theoretically at present)

  • I have a products section with a number field labelled price.
  • An orders section with a subsection manager link to an order details section.
  • A discounts section with a number field labelled quantity.

In the order details section, there are

  • A subsection manager link to the products section, labelled product
  • A subsection manager link to the discounts section, labelled discount
  • A text input field labelled quantity
  • And hopefully a reflection field doing the following: ({entry/products/item/price} - {entry/discount/item/amount}) * {entry/quantity} labelled total

And then in the orders section a reflection field doing {entry/orders/item/total}

Is this going to work, or am I barking in the wrong forest, let alone the wrong tree?

I can do all this with events from the frontend, and not use reflection fields, but how would I do it in the backend if this won't work?

designermonkey, i think that should work.

And then in the orders section a reflection field doing {entry/orders/item/total}

This should calculate sum of totals, right? In which case it probably should be {sum(entry/order-details/item/total)}

works fine for me in 2.2.1

I was just thinking out loud today about a new fieldtype ('slugfield'?) that is somewhat like a reflectionfield:

  • … works with textfields (only). E.g. 'linked' to a Title field.
  • … 'handl-izes' values (Foo &amp; Bar => foo-and-bar) of linked textfield
  • only auto-populates on first save (of linked text-field)

Such a field would enable us to have 'handles' or 'slugs' for an entry that would be 'decoupled' from the title. This way you have the ease of an automagically created handle, but the flexibility to change this. Because this field is only populated on first save you avoid the issues with broken links when a Title is changed (and therefore the default @handle changes).

Does this sound like a nice extra field? Could this be easily done? (could this be a spin-off of the reflection field?)

Just thinking ;)

Can this field be used with conditional filters?

I read about the search: filter but I don't quite get how it should work in my case.

I have a firstname and a partner and a lastname and would like to produce a fullname: "firstname [& partner] lastname" where the & partner is used only when there is a partner.

So, I'm looking for something like: {entry/firstname} {if test: entry/partner != ''}&amp; {/if} {entry/lastname} (which obviously does not work :P )

Hmm I don't think you can do anything fancy like that, no. The only way around this I can think of is to have two reflection fields, one with partner and one without. On the frontend you'd have to check the length, and if the one with partner is more than three characters (space, ampersand, space) longer than the one without, you should display the longer one...

Well, back to Wordpress it is…

Bazinga!

Thanks Nick. I guess I'll handle it in my templates then, no big deal.

[OT]Best use of "Bazinga!" in this forum, congrats![/OT]

The Reflection Field actually supports XSLT files now, so you can just write normal XSLT templates which will handle conditionals or whatever, (with the expected result as a string).

Thank @ahwayakchih for that :)

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