Jump to content
Sign in to follow this  
mikeuk

How do you deal with repeating editable page 'blocks' in PW?

Recommended Posts

(apologies if this looks too similar to previous topic I created, seems more logical as a new topic)

I'm curious if anyone here is implementing something along the lines of Drupal's block / Joomla's custom (editable) module functionality?

In other words, areas that are editable in the backend, that can be placed on multiple pages without needing to re-enter the content on each page it is used.

I tried to do this using a page as a block, and then field type Page (to get a page within a page), but this led to issues with rendering, and more important this creates an object $page->fieldtypePage which is exceptionally large, so I would prefer to avoid that route.

My guess is those that do it, do it outside of PW with PHP. But the 'blocks' being editable and creatable by a site editor is important so I need to explore this or find a different solution (or tell the client no-can-do).

Share this post


Link to post
Share on other sites
3 hours ago, mikeuk said:

apologies if this looks too similar to previous topic I created,

Er, what previous topic? :)...cross-referencing would help a bit here. 

Share this post


Link to post
Share on other sites

I think the way you were doing it before made sense - using a Page Field Selector. Setup in the page-tree a section called "Components" or "Blocks", make sure that isn't being rendered anywhere, then reference those in a field in your front-end facing pages.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By nickngqs
      Hi guys,

      I'm trying to wrap my head around creating dynamic blocks where the end-user can add blocks on the fly on individual pages without specifying it in the templates.

      What approach do you guys usually do? I've tried scouring the forum for solutions but seems to get abit confusing. I've read Hanna Code, Repeater Matrix, PagesTables and seen the youtube tutorials. Not sure, where to start from. I only got very minimal knowledge of php as I came from a front-end background (html, css, js)

      I'm looking to define my blocks somewhere where the end-user will not be able to see.

      For example, a simple block container
      <div class='container'> <div class='container__title'> {{ $title-field }} </div> <div class='container__image'> {{ $image-field }} </div> </div>
      Then maybe we got a second block container
      <div class='container-2'> <div class='container-2__title'> {{ $title-field }} </div> <div class='container-2__image'> {{ $image-field }} </div> </div>
      Then the end-user can just to add these blocks into any pages on the fly and re order them according to their needs. My processwire is v3 using the UIKit3 Admin if that makes any difference

      Sorry if I sounded too noob.
    • By Guy Verville
      I am trying to implement a Repeater Matrix which contains a Page field (there are four fields, an image field, one text field and two page fields). The example given in the readme.txt is self-explanatory. However, this seems not to work with a page field. Say my page field is called "attached_ceramic_skus":
      <?php foreach($page->test_matrix as $item) { echo " <h3>$item->headline</h3> <=works <img... $item->image->url </> <= works foreach ($item->attached_ceramic_skus as $skus)... <= throws an error "; } } } When I debug this line, I see my image and text fields in the $item array, but not the page fields. But these fields are there and working when I enter data. I have understood how they are kept in the database. What is the method/hook to read this type of field?
    • By Matt
      Hello everyone! I recently downloaded ProcessWire and after playing around with it I've found its flexibility and ease of use to be really promising.
      I'm working on a site to publicize upcoming live music events and archive past events at our venue. Each event has the usual start time/end time/price/etc fields and can be associated with any number of bands (usually just one or two). Each band has name/website/description (short bio)/image fields. At the moment I have a page field on my event template allowing each event to be tagged with the required bands, either by choosing existing band pages (for bands which have played at our venue before) or by creating a new band page. I can then reference each band's name/website/description/image in the event template php.
      There are two key ways users will discover events on the public-facing site:
      1) Through the events index page, listing events which can be filtered using dates and keywords
      2) Through the band index page, listing bands whose pages will list past/upcoming events where they have performed.
      However, since:
      a) many bands have gone through minor lineup changes since they started playing at our venue,
      b) many bands have released (and want to promote) new material since they started playing at our venue,
      each band's description and image fields might (but not always) need to vary between events. I would like past event pages to show the band's description/image that was relevant when the event occurred, not the most recent revision. On adding band pages to new events pages, I would like the default description/image to be the most recent version for the band, with the option to replace this with a new description/image if required. It would be unnecessary to provide a new description/image for each band at each event if there were no lineup changes or releases of new material since they last performed.
      My first thought was to have a repeater field for description/image/start time/end time on the band template, where the start and end times help my php template decide which description and image to pair with a particular event. However, the band page field on the events template will not allow me to edit the referenced band page's attributes; it only lets me select band pages and reorder them. If I wanted to update the band description (while preserving the history of previous revisions) I would therefore have to find that band's page elsewhere in the admin then add a repeater row and enter the new description there, keeping the image field blank for that row if the image doesn't need updating. This would require the start time (of the new row) and end time (of the previous row) to be input manually... I'm convinced there must be a simpler way to maintain the links between events and band info.
      My current structure is:
      Home
      -- Events Index
      ---- Event 1
      ---- Event 2
      ---- Event 3
      -- Bands Index
      ---- Band 1
      ---- Band 2
      ---- Band 3
      Apologies if I've misused any terminology  Could anyone advise on sensible strategies for achieving this using Core ProcessWire or modules? Thanks!
    • By DarsVaeda
      Hi,
      I have the following simplified layout on my page:
      ...
      row1_card1 - row1_card2 - row1_card3
      row2_card1 - row2_card2 - row2_card3
      ...
      You can add as many rows and cards per row as you like. Each card has a title, text and a button whose text is the same on every card but should be editable too, just not individually.
      I wonder what is the best approach to do this without making it awfully complicated to setup in the admin from an editors perspective.
      I thought about a solution using a PageTable for the rows and a Repeater for the cards but that started to be complicated to setup even.
      It would be awesome if you could use the FrontpageEditing to edit these cards and even add more or add rows.
      How would you implement it?
    • By abdus
      Hey,
      I'm building a website with following page hierarchy
      home/     /blog (template: listing)         /tags (template: tags)             tag1 (template: tag)             tag2             tag3         post1 (template: post)         post2         post3     /development (template: listing)         /tags (template: tags)             tag1 (template: tag)             tag2         post1 (template: post)         post2
      Ok, so I created a Page field to reference tag pages for categorization of posts in different listings. I set up the field to use InputfieldPageAutocomplete module for quickly referencing and creating any number of tags within a post. However, during the setup, Processwire allows me to pick only one parent. I want to change this behaviour such that when searching for a tag, it should only search under its own listing. Specifically, posts under /development should only be able to reference tags under /development/tags and those under /blog should reference tags under /blog/tags etc. Also, when I create a new tag, it should create under its own tags page.
      I don't want to use a tags page under the homepage, because I want the URL structure to be /blog/tags/journal or /dev/tags/processwire etc, not /tags/processwire. I know I can use input()->urlSegments to achieve the url structure I want, and I did it like that in the past, but it felt too hacky to change the paths for pages from their own path in page tree. I tried hooking into InputfieldPage:processInputAddPages method to make the field accept the correct tags page, but I couldnt make it work.
      How can I achieve this?
×
×
  • Create New...