5 posts in this topic
Recently Browsing 0 members
No registered users viewing this page.
I can't add a new value to a custom PageArray field for my user.
However, when I create a new user, I CAN add the new PageArray value:
I need help. Thank you very much.
As described in this post (https://processwire.com/talk/topic/8551-custom-urls-for-pages/?p=82742) the option 'Name Format Children' under the tab 'Family' in template settings doesn't work properly and also not as expected. I had a look inside the code and made some changes which are working properly, which offers much more options, more consistency and less code too.
The result is the following. You have 3 Options for generating name and title, which could be combined in endless variations.
Name is always derived from title, same like creating pages manually.
type date: if function detects # character anywhere in the string, conversion will be: deletion of # and string will be used as format parameter for PHP date() function type field: if string is a fieldname of the parent page the value of this field will be used type string: if string doesn't fit to the 2 preceeding it will be taken as it is All parts (separated by comma) will be composed in the order of setting. You can use unlimited numbers of parts
I made a pull request on github: https://github.com/ryancramerdesign/ProcessWire/pull/831
will result in
I would like to be able to fetch the labels for fields in a language different than the current logged in user.
For field values that's easy
// p is page, l is language, and f is field $p->getLanguageValue($l, $f); I'm looking for something like
$fields->getLanguageValue('en', 'length'); The only solution I know of is to save the current user language, iterate through the languages by setting the user language and fetching the value, and then restore the user language.
I need to add the original image dimensions (width x height) for the images inserted in the body field, in a few data-fields. Something like:
<a href="/site/assets/files/1092/image-1.jpg"> <img alt="" src="/site/assets/files/1092/image-1.690x0-is.jpg" width="690" data-width="1500" data-height="1000 "> </a> Where data-width and data-height are the image-1.jpg dimensions.
I tried to do this through a file, to control the field output:
templates/fields/post/body.php But turns out the body comes already formatted from the DB, so I can't override the image display, unless I use some cumbersome str_replaces. Even with this solution, it's impossible to achieve the desired result.
Is there any way I can do this through a ProcessWire process?
I know it can be done through php, reading the file's header to extract the height and width and then do a str_replace on the body string to insert the desired code. However I'm curious if it can be done in any simpler and more effective way, without having to read the files from disk and do the replaces.
Is there a way to tell if a field is a multi-language field?
I am currently checking to see if the last 8 characters are 'Language' but that seems like a fragile solution.