Jump to content

Joss

PW-Moderators
  • Posts

    2,862
  • Joined

  • Last visited

  • Days Won

    47

Everything posted by Joss

  1. Hi This is probably me being idiotic! I have created a template that has one area where I want to import the content from another page - in this case a Bootstrap Carousel. I have added a "page" field to select the carousel and that works - I have called the field "import_page" In my template, I have put <?php echo $page->import_page; ?> That, I have discovered, displays the ID of the page, 1018. It looks a very nice number and quite pretty on the page, but I would rather have the actual carousel! So, how do I now render the actual contents of that page in full? All the best Joss
  2. That would do the job nicely! Thanks Joss
  3. There are a growing number of JQuery HTML5 editors out there that are worth looking at. Aloha has already been mentioned and the Developer is really up for getting it into other systems and can be pretty helpful. Redactor is nice, but it is not free. wysihtml5 is a straight forward choice and there is a version for Bootstrap that would be interesting if the admin was using Boostrap. Mercury is an amazing editor, but would need a bit of thought as visually it works as a top browser bar. It works on rails, but can be used without at well. There are a lot of others out there. I think it depends what you want, really. If you are using textarea fields and only want very basic formatting, then these JQuery editors are very good indeed. But, if you want all singing and dancing, which is fine for a personal site, then CK and TinyMCE are still the ones. Offering a selection would certainly be useful! joss
  4. Hi I am pretty new to processwire and it is really growing on me, even though I am not a programmer. One of the things I really appreciate is the freedom and simplicity of the administration structure. However, I think there are a couple of things that could help navigation, and one of those is categorization of templates and fields. This is not intended to be categories for the layout of the site or categorization of data, but simply an optional way of keeping things sorted in the backend if the site gets a bit on the large size. In affect, it would just add another way of sorting fields and templates. For instance, you may want to group fields together that are associated with a repeater, or you may want to group fields together that you tend to use as all-purpose fields like "title" and "image" Anything you wanted really. For many sites, this might be a little bit of overkill, but if a site has a huge number of fields or templates, then this could be useful. Not a major request, just a "nice to have" sort of thing. Joss
  5. Dave or Someone - Can you check through the following? The most recent version of bootstrap allows for the menu to so go one extra level, so, Top, Dropdown, dropdown-submenu. So, I have been playing with Dave's script to add Greatgrandchildren! It seems to be working, but I would really appreciate someone who actually knows what they are doing to check it through and make sure I have it right. I am a professional composer and copywriter, not a programmer! Joss <ul class="nav"> <?php foreach($children as $child) { if($child->numChildren > 0 && $child<>$homepage){ $class = $child === $page->rootParent ? " active" : ''; echo "<li class='dropdown$class'><a href='#' class='dropdown-toggle' data-toggle='dropdown'>{$child->title}<b class='caret'></b></a>"; echo "<ul class='dropdown-menu'>"; foreach($child->children as $grandchild){ if($grandchild->numChildren > 0 && $grandchild<>$homepage){ $class = $grandchild === $page ? " class='active'" : ''; echo "<li class='dropdown-submenu$class'><a href='#' class='dropdown-toggle' data-toggle='dropdown'>{$grandchild->title}</a>"; echo "<ul class='dropdown-menu'>"; foreach($grandchild->children as $greatgrandchild){ $class = $greatgrandchild === $page ? " class='active'" : ''; echo "<li$class><a href='{$greatgrandchild->url}'>{$greatgrandchild->title}</a></li>"; } echo "</ul>"; echo "</li>"; }else { $class = $grandchild === $page->rootParent ? " class='active'" : ''; echo "<li$class><a href='{$grandchild->url}'>{$grandchild->title}</a></li>"; } } echo "</ul>"; echo "</li>"; }else{ $class = $child === $page->rootParent ? " class='active'" : ''; echo "<li$class><a href='{$child->url}'>{$child->title}</a></li>"; } } ?> </ul>
  6. Hi Diogo I don't like hardcoding anything in a menu, except perhaps the home button, since that makes site updates difficult. With Bootstrap, I can create a page with nothing in it and use that as a place holder, but seems a touch overkill! Joss
  7. Hugs and kisses all round .... Oh, okay, just the hugs. Or maybe just a firm, manly pat on the back. Thanks mate! Nice hat, by the way. Joss
  8. Hi Dave, That hasn't worked, though I a not sure why. All it is displaying is the <ul class="nav">, but no contents. Is there something missing, like defining what $children is or something? Sorry, I am rather new to this Joss
  9. Thanks Dave Will go and paste it in, stand back, and light the blue touch paper .....
  10. Hi Is there anyway of generating a placeholder in the page hierarchy? Or do I have to create a blank page? My particular reason is to do with Bootstrap - with the bootstrap navigation, top level parent items that have children will not link to a page. When you hard code, you would normally just put <a href="#">item name</a> which you need to trigger the drop down. However, in the Page structure that creates the menu in Processwire, everything is a page ... or am I missing something? All the best Joss
  11. Hi There, I am just at the very beginnings of working with Processwire - which is interesting because I am not much of a programmer! I have been creating a Twitter Bootstrap front template and have got stuck with working out the menu. Boostrap navbars have very specific classes for the various elements. Importantly: The top level menu <li> that have children need to have the class "dropdown", the <a> tag for that top level item needs to have class='dropdown-toggle' data-toggle='dropdown the child <ul> needs to have the class "dropdown menu" By bending a bit of code I found in another post, I have got part of the way there: <?php function listChildrenTree($children, $current, $w) { echo "<ul class='nav'>"; foreach($children as $page) { $class = ''; if($page->numChildren && $page->id != $rootid) { $class = "class='dropdown'"; } $rootid = $w->pages->get("/")->id; $dropclass = "class='dropdown-toggle' data-toggle='dropdown'"; echo "<li $class><a $dropclass href='{$page->url}' >"; echo "{$page->title}</a> "; $subchildren = $page->children; if($page->numChildren && $page->id != $rootid) { echo "<ul class='dropdown-menu'>"; foreach($subchildren as $page) { echo "<li><a href='{$page->url}' >"; echo "{$page->title}</a></li> "; } echo "</ul>"; } echo "</li>"; } echo "</ul>"; } $children = $pages->get("/")->children(); $children->prepend($pages->get("/")); listChildrenTree($children, $page, $wire); ?> But this is not completely right. $class = "class='dropdown'" - is currently populating all the top level <li> rather than just the ones with parent. I have defined $dropclass = "class='dropdown-toggle' data-toggle='dropdown'"; - but I do not know what to do to put this into the <a> tag that belongs to the <li> that is a parent (but isn't "home") The current code is sort of working, but because I am not getting all the right classes in the right place, it is not working properly. The final rendered html should look something like: <div class="nav-collapse collapse navbar-responsive-collapse"> <ul class="nav"> <li class="active"><a href="#">Home</a></li> <li><a href="#">Link</a></li> <li><a href="#">Link</a></li> <li class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown">Dropdown <b class="caret"></b></a> <ul class="dropdown-menu"> [indent] <li><a href="#">Action</a></li> <li><a href="#">Another action</a></li> [/indent] </ul> </li> </ul> </div> Thanks in advance if anyone can help me out. With Bootstrap being so popular, this might be a useful bit of code to have floating around! I have another related question, but I will ask that separately. All the best Joss
×
×
  • Create New...