Jump to content


Pascal

Member Since 13 Jan 2012
Offline Last Active Feb 24 2012 01:14 PM
-----

Topics I've Started

Select custom CSS for Page

16 February 2012 - 05:45 PM

Edit: Sorry for the Title which has nothing to do with what you are hopefully about to read. I was about to write on a different topic and got carried away.

Hi there!

I just watched the video for the new repeatable fields and this seems to be one of the last features that were missing. It is great! First I thought it would solve the problem I am about to describe, but then noticed that it wouldn't.

I am currently building a page for myself and want to have a modular layout. I don't want a classic layout with a body, a sidebar and a definite number of editable fields per template. What I want to achieve in the content of my page are floatig (inline-blocking, to be accurate) columns which can be added more dynamically. For example, I could have the following "blocks" to build my page's body:

A = A column which has a width of 20em
B = One with a width of 42.5 em
C = One with a width of 65 em
D = One with a width of 65 em and a dark background

So let's say I want three pages where content is supposed to be arranged like this:

A A A
A B__
C____

A A A
D____
B___A
A A A

B___A
A A A
A A A

The normal way would be creating four fields (A, B, C, D) and three templates where these fields are placed in the order described above. The problem is that if I wanted to create a fourth layout, I would have to create a fourth template. As you can see, there is a quite large number of possible combinations. What I want to achieve is the liberty to add new layouts and rearrange content independently of the code out of a set of blocks. Think of it like a letterpress where you can exchange individual characters and rearrange them as you like.

At the moment I am creating each block as a child of the page where it should be placed and assign css classes based on the template name (for example, echo <div class="$templatename">$page->body</div> for each child) Unfortunately, that means that the individual parts of a page appear as individual Processwire pages and clutter the site tree. While this approach is useable, it is not very elegant and abuses the pages for lower-level objects which are not meant to be accessed single pages.

Now this is a feature suggestion and I am feeling bad for it because I value all the hard work that has gone into this great CMS. This is what I was thinking about:

How about allowing users not only to add but to create sub-pages to a page while editing it. Much like the repeating fields which create pages in the background and add a page with the same template over and over again, one could chose from a previously set range of templates (like the template limitation for child pages: allow template-a, template-b and template-c to be added as fields to this template). So one could still render all sub-pages through the markup but would only have to add a new field and some CSS if he wanted to have a field E, which might be a 20em wide column with pink background and bright green text in Comic Sans.

I hope what I wrote made sense to you and would be very happy if someone suggested a workaround that already exists and that I completely missed until now.

array_merge leaves empty array. What's wrong?

19 January 2012 - 12:39 PM

Hi, I am a complete beginner in coding PHP and stumbled upon this problem. This is the code:


<?php
   $contentpages = $pages->get("/content/")->children;
   unset($contentpages[0]);
   echo $contentpages;
   $footersections = $pages->get("/footer/")->children;
   echo $footersections;
   $navlinks = array_merge($contentpages, $footersections);
   echo $navlinks;
   foreach($navlinks as $link) {
	  $class = $link === $page->rootParent ? " class='on'" : '';
	  echo "<div class='nav-button'><a$class href='{$link->url}'>{$link->title}</a></div>";
   }
?>

So first I get the children of the content page and exclude the first one, which is the homepage. The first echo spits out an array of two values. Then I repeat the procedure for sections in the footer which I want to link to. The second echo shows me those values. But then, after using array_merge to merge(?) the arrays, the resulting variable is empty. I suppose I made a really stupid mistake somewere along the way?

By the way, let me know if anything more elegant comes to your mind, I am eager to learn.

index.php not found after install, 404 error

13 January 2012 - 09:43 AM

Hi, I just installed processwire locally under OS X 10.7. I want to try it because it seems to be exactly what I need for several projects.

At first I had the this problem and the solution in that post worked (although I had to change the specific httpd.conf of my OS X user account, which overrides the general httpd.conf). Now apache reads my .htaccess. The problem is that now I am getting the same 404 error on all links except the home page, including the admin page:

Not Found
The requested URL /Users/pascal/Sites/process/index.php was not found on this server.
Apache/2.2.20 (Unix) DAV/2 PHP/5.3.6 with Suhosin-Patch Server at pascal-pc.localdomain Port 80

I have searched the forum but have not encountered any solution. Does anyone have an idea? Can't wait to dig into ProcessWire.

Thanks in advance for your support!

EDIT: I just noticed that visiting the root directory (/process in my case) takes me to the home page. The links seem to be correct (/process/about/, /process/templates/, etc. and /process/processwire/ for the admin login) but every link that goes deeper into the structure results in the above 404 error, no matter if they seem correct or if I use random characters like /process/asdfgh/.