bee8bit Posted August 20, 2015 Share Posted August 20, 2015 Hi! I have a PageTable which may contain pages with different templates that have different fields. The only common field is 'title' but I'd like to show some more useful information. Template A { (PageTitle) title, (Integer) number_one, (Integer) number_two } Template B { (PageTitle) title, (Textarea) body } I found the Cache fieldtype which can combine multiple fields. So I created a cache field named 'summary' and combined number_one, number_two and body. I configured my PageTable to show the columns 'title' and 'summary' and was expecting something similar to this: | title | summary | +------------+-------------------------------------------+ | page_a | number_one: 11, number_two: 22 | | page_b | body: (text goes here ...) | +------------+-------------------------------------------+ It seems to me that PageTable does not like Cache columns. When I try to edit a page with that PageTable, it crashes: Error: Call to a member function attr() on a non-object (line 345 of /var/www/(...)/wire/modules/Inputfield/InputfieldPageTable/InputfieldPageTable.module) Is there a different approach for heterogeneous PageTables? A different syntax to define the columns for PageTable? Thanks for pointers - or a patch ;-) Martin Link to comment Share on other sites More sharing options...
LostKobrakai Posted August 20, 2015 Share Posted August 20, 2015 There isn't any way, that I'm aware of, to archive what you want to do. The cache fieldtype also isn't meant to be used like this. It exists to improve database querying performance on multiple textfields and not really anything more than that. It's not intended to be shown anywhere. Link to comment Share on other sites More sharing options...
Ivan Gretsky Posted August 20, 2015 Share Posted August 20, 2015 You could write a module (or just a hook somewhere like site/ready.php) that would fill a (hidden?) texarea field on page save for the desired templates. That field would probably show in pagetable without an error. Link to comment Share on other sites More sharing options...
bernhard Posted August 22, 2015 Share Posted August 22, 2015 maybe you can use the concat field http://modules.processwire.com/modules/fieldtype-concat/ it will only work for basic output. body html-tags will be shown in the pagetable. maybe you can strip that via textformatter. for more control it would make sense to write your own module. maybe you can adjust a copy of fieldtype-concat to your needs good luck and please share your experience with us - i will also need something very similar the next days... Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now