Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 12/16/2013 in all areas

  1. I just went ahead and did what I wanted to do since a long time. Yesterday at this time there was nothing. Now there's this: http://soma.urlich.ch/ My old portfolio, taking dust, is gone for good! Now I have new shiny blog. Starting with zero, this took a couple hours to setup a complete custom blog. I'm still working out details here and there and adding new stuff I still want to. But what I need and wanted is there now roughly. Some things used in this ProcessWire site: - ModulesManager (of course) - Hanna Code - Repeaters (for the inline code snippets added to content by some Hanna code) - Rainbow JS for the highlighting (http://craig.is/making/rainbows/) - PW Comments Core module - RSS Feed Core module - Markup Twitter Feed (http://modules.processwire.com/modules/markup-twitter-feed/) - Pocketgrid (there's no good grid system other than this http://arnaudleray.github.io/pocketgrid/) - FontAwesome Icon Font No frameworks used except PW. I hope I'll find time to write some things about web dev in general and ProcessWire. Hope you step by now and then.
    6 points
  2. cool - and don't be afraid to rtrim your $demos... <?php echo "("; $gewt = $pages->find("template=addProject, projectManager=$f"); $out = ''; foreach($gewt as $demos) { $out .= $demos->profName->title . ", "; } echo rtrim($out, ", "); echo ")";
    2 points
  3. assuming that you already know about the pages field having to be a single page (not a page array) if you are outputting them like you are (and not foreaching through the variable as if it is an array), then there's no reason why this shouldn't work: <?php $findmylisting = $pages->find("id!=40, roles=superuser, template=user, sort=name"); foreach($findmylisting as $f) { $stateAdd = $pages->get("$f->state")->title; echo '<p>'; echo $f->fullname; echo $stateAdd; echo $f->resourceType; echo $f->ProfName; echo '</p>'; } again i really don't get your naming convention here, it seems quite counter-intuitive, meaning that I cannot easily discern looking at your code what any of the variables are intended to represent; so this is a coding style sort of issue and at least in my experience and reading about general coding and PHP programming, you should really be aiming for readable code, not just the formatting but also what things represent semantically. you should also add comments, like <?php // $foo is a page select which gets the selectable pages from the template bar and returns a single page blah blah blah obviously we have separated each variable out onto it's own line so that you can comment each one out to precicely find which one is causing your error, and then experiment from there with why you are getting the error. We have clearly determined the cause of the error that you posted, which was because you were using a non-existant field name.
    2 points
  4. great. seems as everybody is blogging these days. how do you get the spare time for this? anyway, looking forward to interesting posts. right the first one about file downloads has helped me a lot. thanks for it!
    2 points
  5. I'm nearly done with a site that has a very similar setup. It is definitely possible. The module linked above works well. In my case each mini-site admin can see the other sites, but doesn't have edit privs. If you had to hide the other sites, you could probably hide the main page tree and create a custom admin page that showed a truncated page tree starting at the top level page the mini site admin is allowed to edit.
    2 points
  6. Thats why I always walk with 3 shoes, incase I loose one while walking.
    2 points
  7. I had the same issue and solved it without recreating the field, so I'm posting my solution for others that may face it (and for the developper who could solve it by sanatizing input properly ) The solution is simply to check if there are any blank lines after the last crop dimension in the Input > Thumbnail Settings field and delete them. Note for the developper of the module: a simple trim($crops) (preferably during input) will make this problem disapear. By the way: this module really rocks!
    1 point
  8. Absolutely love your technical drawing skills.
    1 point
  9. I use feedbin.me (I love it, much better than google reader was). It actually didn't recognize somas feed at all, but that seems to be a network issue: https://github.com/feedbin/support/issues/413
    1 point
  10. Hi Enver, so you're simply trying to output a field that is on a 'related' page to the selected user, but where that select takes place is on the project, not on the user. so this is also pretty simple, as you foreach through the users, you also have to do a page search (using api and selector) to find the page(s) that have the current user selected. so within the foreach do another $pages->get("template=addProject, profName=$f"); or something like that - if there are multiples then you would do $pages->find, and then you'll end up with a page array so you'll do a nested loop
    1 point
  11. Try <?php on top of the file.
    1 point
  12. nice, already subscribed via rss. maybe use overflow: auto for the <pre>?
    1 point
  13. Thanks a lot! I have found the Inspector in Nightly also to help. And the config-dev php file is a very good way of testing out stuff. Cheers ! One question though: does PW indicate in some way you are working with a config-dev file and therefore working in a test environment with test config settings ?
    1 point
  14. Adding the missing quote did it, obviously... Why did I not see it?! Ok, why would it matter much that the main.js is loaded before jQuery. Would that pose problems ?
    1 point
  15. Greetings, Looking good! You have so much material here on the forum and elsewhere that you should have no trouble making this blog a full experince very soon! Will definitely watch your progress. Thanks for sharing, Matthew
    1 point
  16. Subscribed at my Android phone. Works fine
    1 point
  17. I tried those out and they all seem to work as expected for me (using the latest dev, 2.3.8). What's the page tree like? In what context are you running that code, in a template file or a module? Are you able to reproduce this behavior on a clean install? Or with some certain steps taken from a clean install?
    1 point
  18. He did it. Just subscribed and looking forward to your posts.
    1 point
  19. Looking great Soma! Can't wait to start reading your posts. I hope they will be many Completely personal preference, but I think that with .block-group{margin-top:-15px} and .masthead{padding-bottom:5px} the blog would look even better.
    1 point
  20. awesome! Lastest Posts = Latest Posts (?)
    1 point
  21. Soma Great, Don't forget to mention some of your gists
    1 point
  22. Today I have added a hook to the module that add pim_* variations to pageimage-variation-collection. This is usefull to not have mass orphaned (pim_)images on the disk when original images got deleted. I have had this code ready for many weeks and would have done some more (workaround for GDlibs buggy sharpening on pngs with alpha-transparency) before update the module. But I haven't had time for this. So, there are no other changes in module version 0.1.1 what is available now at github and in the modules section. Cheers!
    1 point
  23. Hi Jonathan, Mary started a similar discussion a while back: http://processwire.com/talk/topic/4349-thousands-of-pages-one-site-with-multiple-pages-or-one-install-with-multiple-sites/ I don't think it touches on user roles but as Craig said some custom code might do the trick.
    1 point
  24. I think ProcessWire will be able to handle this fine, with a bit of custom code thrown in. Ryan created a Page Edit Per User "proof of concept" module to demonstrate how a role can be used to restrict the editing of certain pages, so this will be an ideal place to start at.
    1 point
  25. Usually this is a good and simple method: In a autoload module you hook into the processInput of InputfieldTextarea. public function init(){ $this->addHookAfter("InputfieldTextarea::processInput", $this, "validateText"); } public function validateText($event){ $field = $event->object; if($field->name == "body"){ $page = $this->modules->ProcessPageEdit->getPage(); $oldValue = $page->get("$field->name"); $newValue = $field->value; echo "old value: " . $oldValue; echo "new value: " . $newValue; if($newValue !== $oldValue){ $field->value = $oldValue; $field->error("Go away!"); } } } For a error message you simply add error("text") to the field. It will get showed after saving. What this examples also shows nicely is how to get the old value and new value. The code may slightly varies for different type of fields but the principle is always the same. There's also a method to hook into Pages::saveReady() but I'm not sure what the advanced really are atm.
    1 point
  26. I like to solve it by having a lot of specific templates, and only 1 basic-page type template. This is in part because I really like to keep pretty strict family settings for each template, so that the client doesn't ever have to decide what template to use when creating a page, and they don't have the option to create pages where they shouldn't. It also opens more options for current or future access control. But the actual template files are pretty spartan, and many of them totally blank, some set or modify a few variables, and others simply include another. I rely on my prepend/append template files to handle all of the common stuff (_init.php and _main.php) leaving the other template files focused purely on any components that are unique for the template. In terms of scalability, I also like having lots of template files, even if there isn't much in them, because future additions and modifications are very simple. So far this way has worked really well for the last few sites I've used it on, but I don't think any one method works best for everyone because we all have slightly different needs.
    1 point
  27. If it is any help, this is what I am doing at the moment. I have decided to use a product tree like this: The following I call sections and all these three levels have the same template detailed below called product_section_list: Products -Girls -Girls Nightware <?php // product_section_list if($page->children) { $sections = $page->children; foreach ($sections as $section) { $firstimage = $section->product_images->first(); echo "<div class='product_section'> <div class='img_ctr'><a href='{$section->url}'><img src='{$firstimage->url}' alt='{$firstimage->description}'></a></div> <h3><a href='{$section->url}'>{$section->title}</a></h3> <!--<p style='text-align:center;font-size:90%;'><span class='product_attribute_label' style='margin-left:1em;'>Price:</span> £{$section->sc_price}</p>--> </div>"; }} ?> What this does is create a top-level product section list that links to each child of the section. So a view of the products page would be something like this (images are just for testing purposes): If you then view the section called Girls you get this: The section Girls Bedding uses a different template called product_item_list see below: <?php // product_item_list $currentpage = $page->categories; $prods = $pages->find("template=product_item, categories=$currentpage"); if (count($prods)) { foreach ($prods as $product) { $priceraw = $product->sc_price; $price = number_format($priceraw, 2, '.', ','); $firstimage = $product->product_images->first(); echo "<div class='product_section'> <div class='img_ctr'><a href='{$product->url}'><img src='{$firstimage->url}' alt='{$firstimage->description}'></a></div> <h3><a href='{$product->url}'>{$product->product_name}</a></h3>"; if("$product->product_size") { echo "<p style='text-align:center;font-size:90%;'><span class='product_attribute_label'>Size: </span>{$product->product_size}<span class='product_attribute_label' style='margin-left:1em;'>Price:</span> £{$price}</p>"; } else { echo "<p style='text-align:center;font-size:90%;'><span class='product_attribute_label' style='margin-left:1em;'>Price:</span> £{$price}</p>"; } if ($user->isLoggedin()) { echo "<p style='text-align:center;color:#c00;font-size:80%;'>Hierachy: {$product->product_hierachy}</p> <p style='text-align:center;color:#c00;font-size:80%;'>Category: {$product->categories->title} ({$product->categories})</p>"; } echo "</div>"; }} ?> This displays a list of the individual products under that section as below: The fields called Hierachy and Category in red on the page are only displayed if a user is logged in for admin purposes. That's the part of the code starting if ($user->isLoggedin()). Each individual product is displayed using a template called product_item. <?php //product_item $firstimage = $page->product_images->first(); $priceraw = $page->get("sc_price"); $price = number_format($priceraw, 2, '.', ','); echo "<div class='product'> <div class='col_1'>"; if ("$page->product_images") { echo "<img id='image1' src='{$firstimage->url}' alt='{$firstimage->description}' /> <p>Rollover image to zoom</p>"; } else { echo "<img src='{$config->urls->templates}images/products/image_placeholder.jpg' alt='No image available' />"; } echo "<!-- end .col_1--></div> <div class='col_2'> <div class='product_title'> <h1>{$page->product_name}</h1> <p><span class='product_attribute_label'>Price:</span> £{$price}</p>"; if("$page->product_size") { echo "<p><span class='product_attribute_label'>Size:</span> {$page->product_size}</p>"; } echo "<p class='product_code'>Product code: {$page->product_code}</p> <!-- end .product_title--></div> <p class='product_description'>{$page->product_description}</p> <div class='add_to_cart'>{$modules->get('ShoppingCart')->renderAddToCart($page)}</div> <!-- end .col_2--></div> <!-- end .product--></div> <div class='separator'></div> "; ?> Which give the following layout: And BTW I am using Apeisa's Shopping Cart Module (Thanks Apeisa) There are two main reasons I did it this way: 1. To give the client a product structure they can visually see. 2. I used to run an ecommerce site using Actinic and this is how it's product sections were structured. Whether this is a good or bad way of doing it I don't know but it works for me.
    1 point
  28. The problem there is that you've got a Process module that is 'autoload', and Process modules aren't meant to be autoload except in specific circumstances. I'd suggest extending WireData rather than Process. Another issue is that you don't want to add that script to every page like you are doing now. You only want to add it when it's needed. So you'd hook into something like ProcessPageEdit::execute instead. This would ensure that your JS is only loaded when it is needed. public function init() { $this->addHookAfter('ProcessPageEdit::execute', $this, 'addScript'); } public function addScript(HookEvent $event) { $this->config->scripts->add($this->config->urls->AdminJQuery . "adminjquery.js"); }
    1 point
×
×
  • Create New...