Jump to content

arjen

Members
  • Posts

    1,222
  • Joined

  • Last visited

  • Days Won

    8

Posts posted by arjen

  1. Sorry, it was late and perhaps I didn't explain myself correctly. I re-edited the post to be more precise.

    $jurisdictionsPageChildren = $pages->get(1011)->children();
    

    Gives as a result: 1012,1013,1014,1015,1016,1017,101,1018,1019,1020,1021,1022,1023,1024

    I would like to split those into a x amount of columns. For example: if I would set the following variable:

    $columnCount = 4;
    

    For example I would like to have 4 columns/blocks.

    Column 1: 1012,1013,1014,1015

    Column 2: 1016,1017,1018

    Column 3: 1019,1020,1021

    Column 4: 1022,1023,1024

    In this case column 1 (the first) should have an extra class 'alpha' and column 4 (the last) should have an extra class 'omega'.

    I already found out that I can slice arrays by using the $a->slice($n, $limit), but I have trouble understanding to iterate over those loops.

    I've also tried to use a while loop for the first loop and a foreach inside the while, but I am having trouble to define $n and $limit. As you can see I can set them by hand, but I thought it would be nice to create a function that sorts things out dynamicly.

    Can anyone point me in the right direction?

  2. $jurisdictionsPageChildren = $pages->get(1011)->children();
    
    // Check whether there are any children before attempting to split them
    if($jurisdictionsPageChildren > 0) {
    
    // Some general vars
    $rows = 2;
    $totalCount = count($jurisdictionsPageChildren);
    $rowCount = $totalCount / $rows;
    // Creating the seperate list (there has to be an easier way to do this)
    $firstList = $jurisdictionsPageChildren->slice(0, $rowCount);
    $secondList = $jurisdictionsPageChildren->slice($rowCount, $totalCount)
    
    $mainContent .= "<div class='row jurisdictions-list'>";
    
    // First list of elements
    $mainContent .= "<div class='columns six alpha'>";
    foreach($firstList as $child) {	
     $mainContent .= "<h2><a$class href='{$child->url}' title='{$child->title}'>{$child->title}</a></h2>";
    }
    $mainContent .= "</div>";
    
    // Second list of elements
    $mainContent .= "<div class='columns six omega'>";
    foreach($secondList as $child) {	
     $mainContent .= "<h2><a$class href='{$child->url}' title='{$child->title}'>{$child->title}</a></h2>";
    }
    $mainContent .= "</div>";
    
    $mainContent .= "</div>"; // Close the row class
    
    }
    

    Okay, here is the deal. I have one list ($jurisdictionsPageChildren) which I want to split into multiple blocks/columns. I would like to adjust this code so I can set the $rows variable to some number.

    The condition is that the first block (regardless of the number of blocks) has to have a class 'alpha' and that every last block has to have a class 'omega'.

    I was thinking to put a foreach in a foreach, but somewhere things got messed up. If this was JSP it would do it like this:

    <c:set var="splittedListHere" value="$(rpfn:splitListFunction(listHere, 2))" />
    <c:forEach items="splittedListHere" var="list" varStatus="i">
     <div class="block$(i.first ? ' alpha' :'')$(i.last ? ' omega')">
    more foreach stuff
     </div>
    </c:forEach>
    

    Any thoughts to make this prettier for a PHP noob are very welcome.

  3. To be honest I thought: what on earch is diogo doing, but I didn't bother to reply because of April's fools day ;) So you got me for five seconds!

    To be honest I thought: what on earth is diogo doing, but I didn't bother to reply because of April's fools day ;) So you got me for five seconds!

  4. That's what I had to learn too. You can look at it from a jQuery point of view. Select/find the element you want to use and do something. That's why I posted the cheat sheet. It's pretty straight-forward. I've got a feeling I've barely scratched the surface, but I do see it's potential. That why PW rocks.

    • Like 2
  5. It depends on how you present the information. If you can see the relations, but don't have any clickable objects, let's say, just a diagram, I think it should be clear enough. I haven't got any clue on how to build this, but after this project I haven't got any new one yet. So it might be worth exploring this further.

    • Like 1
  6. Thanks! That's exactly how I did it in both templates. I thought for the user it would be nice to see in the administration part if a page is linked to another. Therefor the user won't have to look in the other page or on the actual website itself to determine wether any pages are linked.

    I got an employee A who is linked to a service. Also employee B is linked to that service. On the service page (in the administration part) I thought it would be handy to see which employees are linked. Even to de-link them. If you have any thoughts if this sounds too much I would be glad to hear that

    • Like 1
  7. So I started on the project I spoke of earlier and already got most things signed off. With the search function and some video's I was able to build the site. I got a couple of things to work on like a contactform. I guess that shouldn't be to hard. PW seems to be very intuitive and it feels very mature and well thought of.

    I used the Page Fieldtype (thanks Diogo and others from my first thread) to link pages to each other and it works like a charm. The thing is I would to see the relation two ways in the backend.

    Example: I link page A to page B1 and page B2. When I edit page A in the backend I see B1 and B2. But I'd like to see page A when I edit page B1 (or B2).

    I tried to put the same field in the other template, but that (perhaps obviously) did not work.

    What kind of field do I need to put in the template? Is this possible?

    Thanks!

    • Like 1
  8. If I recall it correctly it was due to my interpretation that you were supposed to customize (develop) a lot. The last half year I am becoming more and more confident in some programming basics. I also understand jQuery a lot better. But the mean reason is I read a post of you, Ryan, expaining that learning a tag language (and it's principles - like <txp:get_custom_article />) is not really different than learing some basic PHP loops. That combined with my confidence made me dig deeper. Like I said when I say the backend I was absolutely shocked. This is a lot like I imagined a CMS should be. Plain and simple. And that combined with the easy integration (haven't used it extensively) made me look no further.

    Breaking it down: my interpretation that PW was a heavy developer CMS.

  9. Since I've been working with some custom CMS's (one came really close to which PW defines content) I always wondered how it would like to just have a tree. And all the content should be considered in that tree. It could work for multisites, languages and pages. Searching in the Textpattern forums on a way to define data I've stumbled across a small post. I clicked the PW frontpage away too quickly. Then, a few months later (still searching for the custom fields, custom data, tree like structure) I was willing to spend some energy in ExpressionEngine. Then I saw something regarding a very fanboylike (no pun intended, the guy seemed very sincere) ExpressionEngine article. I guess it's the same one Christoph talked about. Then I saw the backend of the skyscrapersite and I was blown away. Now I'm pitching PW to my agency. Hopefully they will give my team a chance try do some clientwork with PW.

  10. @MarcC, a workfield is a type of business. Let's say farming or banking. I would guess this doesn't make a difference. ;)

    @diogo, maybe I didn't make myself clear. My apologies. The structure itself should be very easy. I'm a bit concerned about the relations, but like MarcC mentoined the news relation to all pages is possible. I think I've found the forum post you are talking about. Thanks for your thoughts on listing the pages. What other post are you talking about? Perhaps I could learn something from it too.

    I have enough information at the moment. But if anyone would like to share I am more than happy to know!

    Thanks guys!

  11. I'm a seasoned Textpattern user, but since I've found ProcessWire I want to try it. I've read all the topics the last couple of weeks and I think this is possible, but I would like to know it for sure. I'm going to pitch this at my agency.

    I've got the following idea:

    Mainpages

    Home

    Workfields

    -Workfield 1

    -Workfield 2

    -Workfield etcetera

    Employees

    -Employee 1

    -Employee 2

    -Employee etcetera

    Work

    -Projects

    --Project 1

    --Project 2

    --Project etcetera

    -Clients

    --Client 1

    --Client 2

    --Client etcetera

    Business

    -Business 1

    -Business 2

    -Business 3

    Also mainpages but not visible in the main navigation

    -News

    --News article 1

    --News article 2

    --News article etcetera

    -Contact

    -Sitemap

    The idea: I want to be able to link the employee to one or more workfields, projects and businesses. This has to be a two-way relation. Let's say one an employee page I would like to list the relation with the projects, the workfields and the businesses. On the projects page I would like to list the employees who have a relation. Etcetera. Also projects needs to have a relationship with workfields and business. This is roughly the same idea as with the employees. I think this is where ProcessWire should come in very handy.

    The thing which confused me a little bit is that I would like to have a relationship between a newsarticle and all other types. So if the webmaster would post a newsarticle he should be able to link this to any other page in the website. This newsarticle should be visible on all pages who have a relation with the article.

    The main point of choosing PW over TXP is the flexibility which looks awesome to me. I could see this working in TXP, but it wouldn't be very userfriendly to define those relationships when adding some content.

    Is this possible at all? Is the news relationthing possible? Does this in any way have an impact on the loadingtime of the page? Since there are a lot of relations to define.

    Thank you all very much for thinking along in advance. Your community seems very nice and reminds me of the nice people in the TXP forums.

    ps. I've seen some Dutch translationwork has been done. Guess I am going pick that up too.

    ps2. My developer wants to use Joomla!, so any thoughts on applying this structure userfriendly would be nice too.

×
×
  • Create New...