Jump to content

kongondo

PW-Moderators
  • Posts

    7,479
  • Joined

  • Last visited

  • Days Won

    146

Everything posted by kongondo

  1. Hi Tino, I don't have an answer to your question...I am just saying hi and welcome to processwire and the forums . Hopefully someone will answer your question ;-) Cheers, /k
  2. Amazing site! It just works... And now am hungry, dessert, anyone? ;-) Cheers/ k
  3. Mark, Thanks. As for posting a tutorial, I am afraid some other work has gotten in the way in the last couple of months :'(I hope to start writing during the xmas break (finger's crossed!). Thanks for your interest. Cheers, /k
  4. Nice, clean and loads super fast...we all know why! . I like the typography. Minor issue on the sessions page (see screenshot) - cramped arrows. Good job!
  5. A few more for you Mary Create Pages (with File-Upload Field) via API http://processwire.com/talk/topic/3105-create-pages-with-file-upload-field-via-api/ And my favorite repo, especially for all things forms, Soma's Gist https://gist.github.com/somatonic
  6. Thanks for this PWired. This is right up my alley. 3D printing is a topic I am interested in...in another life
  7. Welcome back Joss (you and me both )
  8. @Ryan, Thanks for your comments. The original plan was to let non-superusers with the right permissions also use the module. This would enable them to build their own navigation systems easily, a la WP. However, besides security, that could lead to other issues such as wanton addition of menu items! I haven't made a final decision yet. We'll see.
  9. Hi Macrura, Sorry not to have picked this up sooner. I wouldn't use this on a live site just yet, mainly because the user has no way (yet) to delete individual menu items via the GUI. Unfortunately, I don't see myself having time to continue working on this until the end of the year most likely. Please feel free to explore a workaround or adapt it to your needs though, if you wish. Thanks. Cheers, /k
  10. Hi all, You've probably noticed I have been away. I am now back (but will be away here and then). What have I missed please? I have tonnes of posts to wade through (just 15 pages of new threads), thanks Cheers, /k
  11. Thanks for this Soma! Very elegant solution What type of field please?
  12. Actually, I believe it should be 'name' rather than 'title: $images = $page->images->sort("name"); //OR $images = $page->images->find('sort=name'); //OR, by the way, sort descending by name $images = $page->images->find('sort=-name'); //OR, by the way, sort descending by name $images = $page->images->sort("-name"); Tested Btw, you can also sort by other properties, including description, height, width, size (see to be different from "filesize"?), etc. See a list here
  13. Mary, Bear in mind though that 1 template = same fields for each baby site. That will not be your situation, I think, since some sites will have fields that others do not have, no? So, you will have several templates, just not thousands! since there will be commonalities. What Antti (=Apeisa ) is describing is essentially what Soma illustrated in the thread I linked to This is a basic example, and there could be better ways of doing this. Each baby site structure, i.e. the HTML could be added to a .inc file that will be included by PHP to your template file, depending on the page being viewed. The .inc file will also have PHP, especialy PW API in order to output the baby site page's fields. In this .inc file, you may wish to only includethose fields that are unique to a baby site. For instance, all baby sites will have a "title" field. No need to incude that in the .inc file. Instead, include that in a "main.php" as Soma described. Key question is, how do you load the correct .inc file for each baby site? Assuming you have a site structure as follows: Home About Services Baby1 Baby1-Child1 Baby1-G.Child1 Baby1-G.Child2 Baby1-G.Child3 Baby1-G.Child4 Baby1-G.Child5 Baby1-Child2 Baby1-Child3 Baby2 Baby2-Child1 Baby2-Child2 Baby2-Child3 Baby2-Child4 Baby3 Baby3-Child1 Baby3-Child1 Etc.. In order to select any of the above pages in the PW tree, you have several matching criteria on hand. You can select pages based on their parents, IDs, templates, etc. In our case, we want to make this simple. We want a selector that will match each unique Baby site including its children, grandchildren, greatgrandchildren, greatgreatcgrandchildren, etc. That selector can be the $rootParent. This is the "ultimate" parent closest to the "Home" page (i.e. closest to page->id=1). Hence, the rootParent of "Baby1-G.Child5" is "Baby1". The rootParent of "Baby2-Child4" is "Baby2" and the rootParent of "Baby2" is itself, i.e. "Baby2", etc. Armed with this, using the delegate approach, we can include the correct .inc file for each Baby site by giving them unique names. E.g., the .inc file for Baby3 would be, you guessed it, "Baby3.inc". You may choose to name it using the actual name of the Baby Site, .e.g "baby-3.inc" (note: lowercase and hyphen; i.e. PW page naming). Same, for others, e.g. "baby-1.inc". In your "main.php" you would load the correct .inc file as follows, for example: include($config->paths->templates . "views/{$page->rootParent->name}.inc"); This assumes that you have a folder called "views" within your /site/templates/ folders. In the case of Baby1 and its descendants, when viewing those pages, PHP would load the file "baby-1.inc". Inside this file would be, for example the inner markup of the site Baby1. Of course, this assumes main.php will have the rest of the markup, e.g. the header and footer stuff. This also does not directly answer the question, what if there are variations in the Baby site's pages themselves? I.e. the "main page" of e.g. Baby1 could be structurally different from Baby1-Child1. This complicates matters but you can deal with such variations in the .inc file itself since each of your Baby sites will not have that many pages, no? This is a very basic example. It boils down to how you will organise your site. I have not tested this approach for speed/performance but so far, it has worked well for me. There are other alternatives for loading the correct HMTL, as you would have seen in the Soma thread + others not mentioned in that thread. Important to note is this: PW does not prescribe any method over the other. It boils down to your preferences and sensibilties As for CSS, this is one way of loading CSS files: <link rel="stylesheet" href="<?php echo $config->urls->templates?>css/style.css" type="text/css" media="all"> You can easily apply the same logic of the .inc file here. E.g., by having a CSS file called baby-1.css that will be dynamically loaded when viewing Baby1 pages (i.e. replace the "style" with {$page->rootParent->name}.css, for instance. Hope this helps. Like I said, it is just but one example. Others will have other views but this should give you an idea....
  14. Diego, try Diogo's code above. It works like a charm. Like I said, there are some very clever people in the forums. He's one of them . You could make it more specific by using template or parent, etc in the selector or using a "get", like so: $x = $pages->get(2064)->children("single_page_field.count=0")->import($pages->get(2064)->children("single_page_field=1234"));
  15. @Pete, Diego wants to match two conditions - where the field is empty or where the same field has the id=123. I've tried with leaving it empty as you suggest (i..e, nothing after =) + specifying an ID but it doesn't work . Diego used "standard" before, trying to match the name of the page referenced in the Page Field but we know PW does not store the name/title but the ID...Anyway, one gets the following error Fatal error: Exception: SQLSTATE[42000]: Syntax error or access violation: 1066 Not unique table/alias if you try the selector (page_field=1234|) or other variants as I show in my examples above
  16. There are some very clever people in this forum. They'll come up with a solution for sure ...
  17. I am not sure you can do this in the same condition, i.e. I am not sure you can do... field_page=1234|' ' or even field_page=1234|0. I tried but got MySQL errors. I also tried getting the name of the referenced page first and using that as a condition, i.e. field_page=standard|' ' but no joy. Maybe there is a way of doing this, I don't know. Only tested quickly. Testing for AND is easy but not OR in this case.There will be other pointers, am sure .
  18. Hi Ben, Welcome to PW and the forums. Out of curiousity, am wondering ,are you tied to using the Windows Server virtual machine? If not and especially if eventually you want to deploy your site to an Apache, Linux, PHP server, I'd suggest ditching WS virtual machine and instead, test PW on either WAMP or XAMPP. This will allow you to get up and running quickly, especially since you are new to the CMS world.... If these terms don't make sense even after Googling, I'd be happy to provide more info .
  19. Hi Diego, Going by the title of your post, I am assuming that "standard" is the name or title of a page that would be selected via a Page Field? PW does not store the name or title of the page referenced in a Page Field. It goes one better; it stores the ID of the selected page. So, you will have to reference the ID of standard instead of using "standard". E.g. the ID could be 1035. Use that instead. Is this a single Page Field, btw? By storing the ID, PW enables you to easily get all the information about the referenced page. This is just to get you started on restructing your selector (not meant to work immediately). I have to go but may revisit this post if you are still stuck and haven't received help yet...
  20. Former Nokia boss Stephen Elop to receive $25m pay-off.....for a job well-done I suppose? tsk, tsk, tsk... http://www.bbc.co.uk/news/business-24171520
  21. Never trust user input. So yes, you should sanitize user submitted values.
  22. Hi Icedogas, Welcome to PW and the forums. If you switched debug on in your /site/config.php/, you would see the queries. Please note debug should only be turned on in dev/testing installs and not on your live/production server. Find this line in /site/config.php $config->debug = false; and change it to $config->debug = true; Now in the Admin, you will see your queries (scroll down to the bottom). Note, this is only for the Admin. For frontend, you will have to do it differently using PHP code...
  23. Mary, I'll see if I can rustle something up. I would stick with Soma's approach for now. I'm still unsure what you mean by differences here. Maybe provide an (visual) example about the differences? What I mean is this, differences in layout can mean either totally different markup or can mean same markup, but with jQuery and CSS wizardry, a different layout is achieved. Another thing, at this point in time, do you have an idea how the baby sites will look like and how many fields they will require? I don't think so, but just asking. In planning such a site, pen and paper and/or a Spread Sheet are my best friends. I'd write down all the fields that will be needed and note those that will be unique or common...But, I am jumping ahead here.
  24. And here's another by Tina.. http://processwire.com/talk/topic/4541-custom-intranet-app-for-event-logging-and-records-management
×
×
  • Create New...