Hi everyone - I'm completely new to processwire, but really loving it from the get-go.
I must say I was a little put off initially that there is no facility for plain old select fields. On reading this post by Joss (thanks!) I realised that what I wanted to do to begin with was probably much better served by using his method. It must be something along the lines of what Soma is describing above, although - to be honest - it's been too long a day for me to fully follow.
I have a template which features a sidebar and I also have a bunch of blocks of code presenting bits of content gathered from throughout the site ("latest news", "latest projects", etc.). The code blocks are n the form of .inc files in the templates folder and wanted to be able to select which ones would appear on each page. Joss gave me a great way of implementing just that. I followed Joss's instructions to the letter, except I set my field to be of multi-select page type.
In the select_value field of each of the select option pages, I put the names of my .inc 'slot/block' files, e.g. 'sidebar-news.inc'. I end edup with the following 'structure':
Select Fields [page containing all the select field structures]
|
|---- Sidebar Slots [top of my "sidebar slots select values field structure, a field which I named 'sidebar_slots' in my site template ]
|
|---- News Slot [ select_value= 'sidebar-news.inc' ]
|
|---- Latest Projects Slot [ select_value= 'sidebar-projects.inc' ]
etc., etc.
In my template (which of course contains the sidebar_slots field), in the column I have reserved for my slots, I use the following code:
<div class="sidebar">
<?php foreach($page->sidebar_slots as $slot)
{
include("./" . $slot->select_value);
} ?>
</div>
I then go in my page and select which slots I want to be rendered in it.
I can't say I'm thrilled by having my "Select Fields" structure appear on the same tree as my Site Pages. I am building a fairly small site here, which I am going to be managing, but it is easy to see how "pages=select values" can get confusing for some. It almost feels like "pages" is an arbitrary name for what are essentially entities but, semantically I guess you need to start from somewhere more grounded than "entities", in the context of a cms.
On the other hand, I am so grateful for this wonderful piece of software - much, much of my cms wishlist finally come true! - that I already feel guilty for nagging.
Bless you all
Leonidas