Jump to content

Macrura

PW-Moderators
  • Posts

    2,776
  • Joined

  • Last visited

  • Days Won

    40

Everything posted by Macrura

  1. maybe $images = $pages->find("parent=/visuals/, summary|title~={$input->q}, sort=title"); $images2 = $pages->find("parent=/visuals/, tags={$input->q}"); $images->import($images2); http://processwire.com/api/arrays/
  2. many thanks diogo - this maybe should be in documentation, since it's getting common now to include fb og tags, one of which is the image; so using a custom crop, one can provide facebook with a proper image in the event a visitor 'likes' a particular page.. <?php echo 'http://' . $config->httpHost . $page->image->url; ?>
  3. thanks WillyC & diogo - I was doing it Willy C's way, because the api outputs the trailing slash on the root url and then a preceeding slash on the image url; @diogo - are you saying that $config->httpHost doesn't output the trailing slash? somehow i thought it did, but can't test right at the moment...
  4. Regarding the image URL, is there an easy way to echo the full URL, including the domain etc..; for example if you needed to provide the full image URL for something like an open graph tag; So if this was available from the api, it could be useful: $image->httpUrl
  5. What Ryan says is completely true, my knowledge of PHP is simple, but i've built some interesting/complex things using only the basics listed, and the fact that you can build almost anything using only those basics and the cheatsheet is the strength of it's underlying design. With PW, i think it's more about how you can visualize the relationship between your content in the backend and how you will output that in the front..so more like creative thinking, problem solving... it is for this reason that processwire is so much fun as @yellowled points out, because you find yourself being inventive and coming up with cool ideas that no other CMS would 'provoke'... it's nice to finally be able to say to clients "yes that can be done"
  6. Macrura

    Before PW & After PW

    thanks raymond.. before got me in stitches ...watching again
  7. it would be cool if there were a searchable and tagged repository of PW code snippets; each code sample could include the commented code, tags (like menu, gallery, user, forms, search etc.) and maybe a description field where you could put in what the context was. i'm always bringing up previous sites that I solved a problem on to see what the code I used was, and then copying/modding it to the new project.. edit: i just installed CodeBox and looks good. can also send snippets to gist
  8. Hey Luis - thanks looking awesome! -marc
  9. for these types of situations, i always use a custom menu that is managed by a hidden page tree.. works great and lets you make your menus how you want, regardless of page tree structure... http://processwire.com/talk/topic/2787-custom-menu-not-related-to-page-tree/
  10. yay! this is awesome. couple of issues: 1.) comming soon (spelling is coming) 2.) is there any way to disable the module from showing any site IDs besides the one you enter? RIght now it shows all of the piwik sites, but i would only want to show the specified site, such as '6' (and not 1 • 2 • 3 • 4 • 5 • etc..)
  11. there was a post, can't find it now, where someone added the blog profile to an existing site; though i agree it will be easier to just 'roll your own' blog, the way you want, and there is some reusable code in the blog profile that should speed up things like categories, RSS , etc.
  12. hey i'll add to the rant @totoff - you mean themeforest i think ? i think the prefabs are necessary for some devs and users, and for certain projects; I'm a sworn PW user, but i have a site running joomla because there is a really good invoicing system called nBill; and some CMS have advanced prebuilt addons (a.k.a. plugins/modules/components etc..) like community, calendars etc.; so you have to do research and consider budgets before you choose the cms for the project. When you can use PW you'll be relieved, it has the best admin UI hands down of any CMS. i just got done converting a wordpress template, one that I liked a lot, to use in a processwire site – it was really educational; i was able to see how the wp theme was coded and it wasn't a pretty site. Tons of code bloat (but all necessary to make the theme usable to a wide audience); and then i was able to go and attain all of the functionality of the wordpress version and more using 1/20th of the code; and i'm able to do really cool things now with the content management, media (audio, video) that would be completely impossible in WP, or would be a ridiculous hack job...
  13. Hi Wanze - many thanks - great and simple solution, nice thinking! here is how i finally implemented: <?php $tags = $pages->find("template=tag"); foreach($tags as $tag) { $c = $pages->count("template=audio, tags={$tag}"); if ($c == 0) continue; ?> //filter <li> markup here <?php } ?>
  14. Hi all, i think i need some help with this: I have a field called Tags, which is a pageAutocomplete field, and allows the user to enter tags for a page; Then on the template i have an isotope display which has a filter, using the tags; Right now i'm just cycling through the tags (selector for template=tag) to create the list of filter links; but is there a way to check that a given tag is actually in use, by a page, since right now if someone enters a tag and then deletes it, that tag is still a tag page, but if you click on that filter, no items are displayed... TIA
  15. Hi Basil, processwire is great, but it's not going to be a turn-key solution like wordpress, joomla etc.. you will have to know a bit of php to really make it work; I would recommend to spend some time reading the forum, all of the documentation, as well as Joss' great tutorials; and also check out the cheatsheet. You'll also find that reading through the code in the different site profiles will give you some answers. i think i spent about 1-2 month reading the forum before i actually tried to make a site with pw.
  16. keep everything in your template the same, delete the slideshow items, then get your sideshow items from pw into an array, then cycle through them in foreach, sort of like this (this is untested psuedo-code, just to give you an idea) <?php if(count($page->images)>0) { foreach($page->images as $img) { ?> <li> <a class="thumb" name="drop" href="<?php echo $img->url; ?>" title="<?php echo $img->description; ?>"> <img src="<?php echo $img->url; ?>" alt="<?php echo $img->description; ?>" /> </a> <div class="caption"> <?php echo $img->description; ?> </div> </li> <?php }} ?>
  17. Hey Nico - great and useful module! It would be good to point out that this module requires PHP 5.3, else your whole site will WSOD. -marc
  18. Yeah, the flexible content is kind of cool if you have situations where you have a lot of pages that don't all really conform to any single template, but most of the time when you have your content really well structured, and analyze what the output needs to be, you might find that this type of thing is really not necessary; if your needs are not that complex you could create a sort of generic repeater, where there is a select list for what is contained in the text area, like content, teaser, etc. then you could check the value of that select field and output the markup accordingly.
  19. Hi Jennifer - really nice site; just also wanted to alert you that the contact button on the homepage also brings up a pop up with a 404; http://fyp.washington.edu/fyp/contact-form/ i think it is the /fyp/ that is causing that.. -marc
  20. @Matthew - I'm curious as to how things are going with Foxycart; I have a client who needs to pick a cart soon and we're looking at several options.
  21. this is definitely *THE WAY* to make a sitemap...! Thanks... spent a long time trying to make a 3 column sitemap using CSS3 column count, however it will not work if you have home as a 'parent' <li> to the rest of the list, because the browser will keep all of the child items of that <li> in one column... with the MSN module, you can prepend the homepage, so it is in it's own <li> on the same level as the rest of the site...
  22. Thanks Ryan - I think i will use the redirect template idea for some things..Right now there are no multiple URLs, everything is well organized in the page tree, diescrreet now you're giving me some ideas about how to improve this – right now the products are arranged heirarchially under one parent, and then 4 'categories' with all of the products under each of those; But now i'm thinking that ALL of the products should have the same parent, i think this will make it more flexible to show search results.. then i guess i'll use URL segments for the product category, application, name etc...if i do it this way, there will be multiple URLs to the same page, but i could then use canonical URLs;
  23. Hey Ryan - thanks for replying to this. RIght... i think in most cases using the PW tree to generate the menu is best; But it does speak to the flexibility of PW that you can do something like this with relative ease when required...and in setting this up I learned from Soma's bootstrap menu markup how to generate complex nav markup without using a plugin.. I have heard it said somewhere that the navigation menu should be optimized for the user and not be constrained by the hidden structure of the site, especially for larger sites. In this case, it is a company where many of the products overlap in functionality, so there needs to be several routes for different users to arrive at certain pages. And they are not extremely organized yet about the content, so i'm sort of dumping all of the content into the tree in what seems like a logical structure, and then linking to things as necessary, with the custom menu. It's also helping to prevent confusion in some cases for links to external sites, where those would have been showing in the page tree if we did it that way. This site will also have a lot of advanced search and filter types of things, so the nav is kind of secondary to that route for finding pages... -marc
  24. Recently I've been working on a site where it seemed like it was going to be impossible to keep the page tree and the needs of the site's main menu in harmony; So to solve this I setup a separate page tree under a hidden page called 'Main Menu', with each menu item having three fields: title, menu-link-page, and menu-link-url. All of the menu items are also hidden, so the code below uses the include=all parameter when getting the pages for the tree. To generate the main menu markup, i adapted the great code that was developed by Soma for Joss's bootstrap menu, and modified it to output links to the menu-link-page or menu-link-url; (Entering a value in the menu-link-url field overrides any selection in the menu-link-page.) This solution has enabled me to setup the menu exactly how the site needs it, even if the menu heirarchy is not the same as the page heirarchy, and has solved a lot of problems and made things easier for this scenario. For example, menu items can easily contain external URLs, to subdomain pages, or other related site's pages. (In this case the client has a separate web store for selling parts). Also, all of the parent menu items had to use a javascript:void() as the href, in order for the accordion version to work right on mobile; So this was easy to do by putting that into the menu-item-link field. In the code below, page #1271 contains the menu tree, so it is specified as a parameter to the $root variable. I think this sort of setup, using a custom menu tree, could solve a lot of the questions I've seen recently on the forum; I probably wouldn't use this technique on small sites since it is more work, but for larger ones where you might need a lot of menus, this could be helpful. Also, if you had to setup a Mega Menu, with images and icons, this might make it easier to manage. <?php /** * render custom markup menu for bootstrap nested navigation * * @param PageArray $pa pages of the top level items * @param Page $root root page optional, if you use other root than home page (id:1) * @param string $output for returned string collection * @param integer $level internally used to count levels * @return string menu html string */ function renderChildrenOf($pa, $root = null, $output = '', $level = 0) { if(!$root) $root = wire("pages")->get(1); $output = ''; $level++; foreach($pa as $child) { $class = ''; $has_children = count($child->children('include=all')) ? true : false; if($has_children && $child !== $root) { if($level == 1){ $class .= 'parent'; // first level boostrap dropdown li class //$atoggle .= ' class="dropdown-toggle" data-toggle="dropdown"'; // first level anchor attributes } } // make the current page and only its first level parent have an active class if($child->menu_item_page === wire("page")){ $class .= ' active'; } else if($level == 1 && $child !== $root){ if($child->menu_item_page === wire("page")->rootParent || wire("page")->parents->has($child)){ $class .= ' active'; } } $class = strlen($class) ? " class='".trim($class)."'" : ''; if($child->menu_item_url) {$childlink = $child->menu_item_url; } else { $childlink = $child->menu_item_page->url; } $output .= "<li$class><a href='$childlink'>$child->title</a>"; // If this child is itself a parent and not the root page, then render its children in their own menu too... if($has_children && $child !== $root) { $output .= renderChildrenOf($child->children('include=all'), $root, $output, $level); } $output .= '</li>'; } $outerclass = ($level == 1) ? "accordmobile" : ''; return "<ul class='$outerclass'>$output</ul>"; } // bundle up the first level pages and prepend the root home page // $root = $pages->get(1); // $pa = $root->children; // $pa = $pa->prepend($root); // Set the ball rolling... // echo renderChildrenOf($pa); // example with pages further down in the tree $root = $pages->get("1271"); $pa = $root->children('include=all'); // $pa = $pa->prepend($root); // add the root as the second parameter echo renderChildrenOf($pa,$root);
  25. since i've done this kind of thing a lot, the first thing i notice about your setup is that you are using an image field within a repeater, but the image field already supports multiple images, so if i was doing this, i would not use a repeater, but just a plain image field, that allows multiple images. if you are only going to have 1 featured project, then this should work, assuming you don't put the image_field inside a repeater: $featured = $page->featured_project; $img = $featured->images->first(); $thumb = $img->size( 100, 100 );
×
×
  • Create New...