Jump to content


  • Content Count

  • Joined

  • Last visited

Community Reputation

3 Neutral

About ljones

  • Rank
    Distinguished Member

Profile Information

  • Gender

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Ryan, That explanation was awesome! I could not get the if/else code to work, but it really does not matter because I just put the specific code I needed in the home template like this: <?php $content = " <div id='content' class='row'> <div id='bodycopy' class='large-8 columns' role='content'> $body </div> <aside id='sidebar' class='large-4 columns'> $side </div> </div><!--/#content--> "; And in the portfolio template I did this: (I am pulling fields from the child pages.) <?php foreach($page->children as $child) { $img = $child->port_thumbnail->first(); $portfolioGrid .= " <div class='large-3 small-6 columns'> <a href='$child->url'><img src='$img->url'></a> <div class='panel'> <p>$child->title</p> </div> </div> "; } $content = " <div id='content' class='row'> <div class='large-12 columns'> <div class='row'> $portfolioGrid </div><!--row--> </div> <!--large 12-column--> </div> <!--large 12-column--> "; I am not sure if that is the best practice for getting the portfolioGrid varible into the content section, but it works. If something is wierd, let me know. I tried to do it as a function in the _nav.php file, but that proved to be a little too difficult for me at my coding level. I LOVE not having to include the foot.inc and header.inc in all of these templates. Thanks again!
  2. I understand how the various templates add to the _main.php file, but is there a way to still use the _main.php file and easily subtract the sidebar? For example, I want a portfolio page that spans the 12 columns, with no sidebar. This was my solution: copied the _main.php file renamed it to portfolio.php added $useMain = false in the template header deleted the sidebar column and changed the body copy div to "large-12 columns" created a portfolio template without the sidebar in the admin section It works, but I am guessing there is a better, more elegant approach.
  3. Soma, Everytime I get help from you guys, I am blown away by your talent and skills. Thanks again.
  4. Thanks so much for your help Soma. Since the fullcallendar js for the big calendar page needs to have start_date and end_date formatted like this, ("Y-m-d H:i"), I have to stick with that on the field formatting in the back end. So that is why I am applying the strtotime formatting to show on the home page. I was making the false assumption that DATE_FORMAT settings worked in strftime, so thanks for that link. There is probably a way to use a fullcalendar json feed to show the info on the homepage, but processwire made more sense to me since I am not very proficient in javascript. So I am not sure if the below code is the most elegant solution, but it works and it seem to be easily adapted to provide a range of days, if needed. Below code has been edited to include Soma's fomatting advice. <? foreach($pages->get("/events/")->children("date_start>=today, date_start<tomorrow") as $child) { echo "<li><a href='{$child->url}'><p>" . strftime("%l:%M %P", $child->getUnformatted("date_start")) . " {$child->title}</p></a></li>"; } echo "</ul>"; ?>
  5. I have a lot of repeater data too. I discovered them by doing a front end search when I was logged in. They showed up in the search results. (they don't show up on the front end when not logged in.) I am using the Bootwire Demo profile with the the twitter bootstrap profile demo profile theme if that makes any difference.
  6. This solved my date format problem: sort of: the minutes are not rendering correctly. 7:00 shows a s 7:07 and 5:00 shows as 5:05 If I put an %i it just shows an i. %r shows the time fine, but like this: 07:00:00 Maybe it's because I am running it on a local mamp environment and it won't be an issue on my server. strftime("%l:%I %p", strtotime($child->date_start))
  7. Thanks to this post, I have integrated sakkoulas' code and have full calendar page working. I want to set up a feed to the homepage to display today's events and link to the event. This is what I have so far on the home page: <?php foreach($pages->get("/events/")->children as $child) { echo "<li><a href='{$child->url}'>" . $child->date_start . " {$child->title}</a></li>"; } echo "</ul>"; ?> This code just pulls all of the events and shows the date like this: 2013-06-02 12:00. I am not sure if this is best practice or not. But I am stuck on two points: I can't figure out how to override the field default time format for child->date_start to just echo the hour and minute and I don't know how to select just today's listings. Any advice would be appreciated. Thanks.
  8. Ryan, That was exactly what I needed. That makes a lot more sense than editing the core module. Thanks!!!
  9. Thanks adamspruijt, I'm a designer, not a coder, I can hack things to some extent, but the blog profile does not seem to have any way to wrap a div without doing so in the MarkupPagerNav.module, so I did it there: // List container markup. Place {out} where you want the individual items rendered. MarkupPagerNav 'listMarkup' => "\n<div class='pagination'>\n<ul>{out}\n</ul>\n</div>", And I made this change as well: 'currentItemClass' => 'active', Bootstrap does not use a span, so I took them out here: // List item markup. Place {class} for item class (required), and {out} for item content. 'itemMarkup' => "\n\t<li class='{class}'>{out}</li>", I am not sure if this is a proper way to do this, but it works, as I tested it. I don't even know what specify a second $options array to the render method means. But I have come a long way..This is the first time that I had the courage to hack around in a module. Doing it this way means I don't have to edit the Bootstrap.css, but it does mean that I have to keep up with the edits to the module.
  10. I am working on adapting Ryan's blog profile to work with the Twitter Bootstrap framework. Everything is moving along pretty well, but I have hit a roadblock with Pagination. Twitter framework uses these classes <div class="pagination"> <li class="disabled"> <li class="active"> Is there an easier solution than editing the MarkupPagerNav.module code? It's a little over my head, and I am concerned about changing module code. This is where I last looked and decided that I was a bit uncomfortable changing this code and trying to keep up with it with future upgrades etc. Is it easier than I think? Is there a way to make these changes without editing the module? Can you even change the protected $options code? MarkupPagerNav generates it's own HTML5/XHTML markup. To modify it's markup * or options, specify a second $options array to the render() method. See * the MarkupPagerNav::$options to see what defaults can be overridden. /** * Options to modify the behavior and output of MarkupPagerNav * * Many of these are set automatically. * */ protected $options = array( // number of links that the pagination navigation should have (typically 10) 'numPageLinks' => 10, // get vars that should appear in the pagination, or leave empty and populate $input->whitelist (preferred) 'getVars' => array(), // the baseUrl from which the navigiation item links will start 'baseUrl' => '', // the current Page, or leave NULL to autodetect 'page' => null, // List container markup. Place {out} where you want the individual items rendered. 'listMarkup' => "\n<ul class='MarkupPagerNav'>{out}\n</ul>", // List item markup. Place {class} for item class (required), and {out} for item content. 'itemMarkup' => "\n\t<li class='{class}'>{out}</li>", // Link markup. Place {url} for href attribute, and {out} for label content. 'linkMarkup' => "<a href='{url}'><span>{out}</span></a>", // label used for the 'Next' button 'nextItemLabel' => 'Next', // label used for the 'Previous' button 'previousItemLabel' => 'Prev', // label used in the seperator item 'separatorItemLabel' => '…',
  11. Found a solution here: http://processwire.com/talk/topic/563-page-level-and-sub-navigation/page__hl__subnavigation__fromsearch__1
  12. I am working on a simple photo gallery site where I have level one: Home, Galleries, Statement level two: Set 1, Set 2, Set 3 etc. (under Galleries) level three: a template that cycles through the child photos of Set 1, Set 2 or Set 3 set by using this code: if ($page->prev->id) { echo "<a href='{$page->prev->url}'></a>"; } else { $lastpage = $page->siblings->last(); echo "<a href='$lastpage->url'></a>"; } echo "<a href='{$page->parent->url}'></a>"; if ($page->next->id) { echo "<a href='{$page->next->url}'></a>"; } else { $firstpage = $page->siblings->first(); echo "<a href='$firstpage->url'></a>"; } echo "<img class='centered' src ='{$page->images->first()->url}'"; The level one and two navigation menus show the the active links as "on" and highlighted according to my CSS declarations at level two. For example: Home Galleries Statement [set One] [set Two] [set Three] [Thumbnail 1] [Thumnail 2] [Thumbnail 3] But clicking on the Thumnail 2 and cycling through turns off the Set Two link: Home Galleries Statement [set One] [set Two] [set Three] <prev [image detail] next> What do I need to add or change to make the second level navigation show as being "on"? This is the code I am using in the header included in all templates at level 1, 2, and 3: <div id="primary-menu"> <?php // Create the top navigation list by listing the children of the homepage. // If the section we are in is the current (identified by $page->rootParent) // then note it with <a class='on'> so we can style it differently in our CSS. // In this case we also want the homepage to be part of our top navigation, // so we prepend it to the pages we cycle through: $homepage = $pages->get("/"); $children = $homepage->children; $children->prepend($homepage); foreach($children as $child) { $class = $child === $page->rootParent ? " class='on'" : ''; echo "<a$class href='{$child->url}'>{$child->title}</a>"; echo " "; } ?> </div> <div id="secondary-menu"> <?php echo "<hr>"; // Output subnavigation // // Below we check to see that we're not on the homepage, and that // there are at least one or more pages in this section. // // Note $page->rootParent is always the top level section the page is in, // or to word differently: the first parent page that isn't the homepage. if($page->path != '/' && $page->rootParent->numChildren > 0) { // We have determined that we're not on the homepage // and that this section has child pages, so make navigation: foreach($page->rootParent->children as $child) { $class = $page === $child ? " class='on'" : ''; echo "<a$class href='{$child->url}'>{$child->title}</a>"; echo " "; } echo "<hr>"; } ?>
  13. Thanks Apesia, I decided to use the full circle code. I was able to tweak it so that I can circle backwards as well. It works just like this site I built in Wordpress using a very nice, but bulky plugin that required a lot of hacking. http://lopemaxdiaz.com/paintings/image-7-la-colora There will be fewer that 40 sibling pages per parent, so I don't think that will be too much of a load. Thanks again!
  14. I have read over the API and am stumped on how to do this. I don't want a "previous" or "next" graphic to show up when there is a null page on either end. Obviously this code will not work $page->prev->url->NullPage [or maybe sibling->first() or ->last()]? and does not function, but it gives an idea of what I am trying to do: <?php echo "<div class='gallery-detail-nav'>"; if ($page->prev->url->NullPage) echo "<a href='{$page->prev->url}'><img src='{$config->urls->templates}stylesheets/images/null.jpg' /></a>"; else echo "<img src='{$config->urls->templates}stylesheets/images/back.jpg' /></a>"; echo "<a href='{$page->parent->url}'><img src='{$config->urls->templates}stylesheets/images/thumbs.jpg' /></a>"; if ($page->next->url->NullPage) echo "<img src='{$config->urls->templates}stylesheets/images/null.jpg' /></a>"; else echo "<a href='{$page->next->url}'><img src='{$config->urls->templates}stylesheets/images/next.jpg' /></a>"; echo "</div>"; I would also like to figure out how to cycle in a circle, if possible.
  15. SiNNuT, That is a very elegant solution. I don't yet have this site online, but It works perfectly on my development site. <style> <?php $bkgimages = $page->parents()->append($page)->filter("bkgimage!=''"); $last = $bkgimages->last(); echo "\nbody {\nbackground: #fff url({$last->bkgimage->url}) center center fixed no-repeat;\n-moz-background-size: cover;\nbackground-size: cover;\n}"; ?> </style> yields this: <style> body { background: #fff url(/processwire4/site/assets/files/1006/art-1.jpg) center center fixed no-repeat; -moz-background-size: cover; background-size: cover; }</style>
  • Create New...