Jump to content

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


mikeuk
 Share

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).

Link to comment
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.

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By rookie
      hi there everybody,
      I'm new to Processwire and I'm trying to figure out how things can be done. First of all i'm no developer so i have some difficulties with php and coding at all.
      So I tried to put some sections on the home page of the website I am going to create. The point is that i'm unsure if this is the way to go. Maybe there is an easier way or something completely different. I would like to do this without any plugins or some kind of stuff.
      How can i limit the amount of columns if i do it this way? ( a 3 column section can have only 3 columns right? )
      And Yes i did read the tutorials.
      How do you guys do this?
      For a better understanding I have included some pictures.
      Thank you.


    • 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?
×
×
  • Create New...