# arjen

Members

1,222

8

1. ## My Last 3 Months - StrategyCore

Works great. The bookshelf is indeed nice. Looking forward to the case study.
2. ## Multiple lists and loops into dynamic reusable piece of code

I've heard of the library before. Is this work in progress or just an idea yet? I think it would be a great idea.
3. ## Multiple lists and loops into dynamic reusable piece of code

Glad you liked it. I think i'm going to try to make this a module. I got some more ideas like sorting the elements in a horizontal way. I use a lot lists and this seems very reusable. Got to finish this project and then I think I have some spare time to try this.
4. ## Multiple lists and loops into dynamic reusable piece of code

Check, check, check. You're better at math than me. Very clear code. This makes a lot of sense. I will use this. Thanks diogo!
5. ## Multiple lists and loops into dynamic reusable piece of code

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?
6. ## Multiple lists and loops into dynamic reusable piece of code

\$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.
7. ## joaovieirasantos

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!
8. ## If first/last page in array

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.
9. ## If first/last page in array

The cheat sheet helped my out on numerous occasions for getting the stuff you want. Very useful for this kind of information.
10. ## Page Fieldtype two way relation

Thanks Ryan, for now I will look up the relation in the front-end. It does make sense indeed because you can see the context.
11. ## Page Fieldtype two way relation

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.
12. ## Page Fieldtype two way relation

Thanks for clarifying Apeisa. It isn't that big of a feature, but it would be nice.
13. ## Page Fieldtype two way relation

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
14. ## Page Fieldtype two way relation

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!
15. ## [New project] All kinds of relations between pages

Got it done. Some folks wanted WordPress on this site. But I'm glad it will be ProcessWire! Will keep you guys posted on the project. I am confident everyone here will be pleased after we complete the site. Thank you all for your input!
16. ## Where did you find about ProcessWire?

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.
17. ## Where did you find about ProcessWire?

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.
18. ## [New project] All kinds of relations between pages

@diogo, no worries. Glad you pointed me to the video! Thanks! @apeisa, thanks for your thoughts. I would guess an ajax search to find the specific pages would be quite userfriendly. @ryan, no need for concerns on that part, thank you for your detailed explanation. I will pitch this to my company. I'm already convinced
19. ## [New project] All kinds of relations between pages

@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!