Using $CPF_LIST w/ fractional editing
Posted
#3638
(In Topic #710)

Standard member

According to the documentation, fractional editing requires a list separated by a |
$CPF_LIST returns all values separated with a comma and oddly repeats the value. Example:
Code
value1=value1,value2=value2,value3=value3, etc.
I imagine I can surround $CPF_LIST with $REPLACE to replace the commas with |, but I'm not sure how to remove the value= part (CPF values all contain different amounts of characters as well).
Posted

Site director

First, I had to make a few fixes:
https://github.com/ocproducts/composr/commit/8e947c532181155ea698b1185b308562162121ea
Then I did it like:
Code
{$SET,edit_type,{$SUBSTR,{$PREG_REPLACE,(^|\,)([^=]*)=([^\,]*),|$2,{$CPF_LIST,Currency code}},1}}
(I just used Currency code as that is a default CPF with a list that I could test with).
Become a fan of Composr on Facebook or add me as a friend. Add me on on Mastodon. Follow me on Minds (where I am most active). Support me on Patreon
- If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
- If so, please let others know about Composr whenever you see the opportunity or support me on Patreon.
- If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying Composr on fun personal projects.
- If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Posted

Site director

https://github.com/ocproducts/composr/commit/71cfbb817a99646226541f2719fd3b96326d8473
Code
{$SET,edit_type,{$CPF_LIST,Currency code,|,0}}
Become a fan of Composr on Facebook or add me as a friend. Add me on on Mastodon. Follow me on Minds (where I am most active). Support me on Patreon
- If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
- If so, please let others know about Composr whenever you see the opportunity or support me on Patreon.
- If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying Composr on fun personal projects.
- If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Posted

Standard member

This was working but no longer does. Not sure what happened. Instead of showing a dropdown, it just shows a text field now, almost like it's ignoring $SET.
I don't recall upgrading my installation since you've posted this. It's possible but I'm unsure. I compared both CPF_LIST.php on Github and in my installation, they are both the same.
Is it possible something else could've affected this?
It's not too big of a deal - I'd rather it be dynamic in case I make a change to one of the CPF drop down values so then it'll update on its own when using fractional editing, but worse case scenario I can just manually hard code the drop down values.
Posted

Standard member

What happened was I created a new theme and doing so somehow reverted the changes to FRACTIONAL_EDIT.tpl, so it wasn't using $GET to retrieve the edit_type.
It's fixed now. Sorry.
1 guest and 0 members have just viewed this.