Jump to content

ljones

Members
  • Posts

    31
  • Joined

  • Last visited

Everything posted by ljones

  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>
  16. Amazing timing stillmovingdesign! I was just typing this up as you posted your solution to my problem. I am posting this reply anyway just in case someone wants to see how I incorporated the stylesheet. Apesia and Pete, Thanks so much for your help. Apesia, I did decide to limit the background image to one file. I had to do an if / else to make it work. Everything works great with the following code. If the top level pages do not have a background image, they inherit the homepage image. If I put an image on a top level page it is passed on to all of the children. <style> <?php $parent = $pages->get("/"); if ($page->bkgimage) echo "\nbody {\nbackground: #fff url({$page->bkgimage->url}) center center fixed no-repeat;\n-moz-background-size: cover;\nbackground-size: cover;\n}"; // or else echo "\nbody {\nbackground: #fff url({$page->parent->bkgimage->url}) center center fixed no-repeat;\n-moz-background-size: cover;\nbackground-size: cover;\n}"; ?> </style The only problem is that if I do not have a top level page background image the children of that page have nothing to inherit. However, that is not really a problem because I plan to have a different background image for any top level page that will have children.
  17. I get the logic now. These both give me what I want. I know enough to work with a foreach or a if/else, but it's a bit beyond me to combine these things. I guess I was looking for a solution that was not as simple as I had hoped. <?php foreach($page->bkgimage as $img) { echo "{$img->url}"; } ?> <?php $home = $pages->get("/") ; foreach($home->bkgimage as $img) { echo "{$img->url}"; } ?>
  18. Maybe I am making things too complicated. I don't really need a foreach because I only have one background image per page. The following code pulls in everything i need except the image filename: <style> <?php if($page->bkgimage) echo "\nbody {\nbackground: #fff url({$page->bkgimage->url}) center center fixed no-repeat;\n-moz-background-size: cover;\nbackground-size: cover;\n}"; else echo "\nbody {\nbackground: #fff url({$parent->bkgimage->url}) center center fixed no-repeat;\n-moz-background-size: cover;\nbackground-size: cover;\n}"; ?> </style> Is there a simple way to get the filename added in this statement: {$parent->bkgimage->url}? This is the page source that is echoing out: <style> body { background: #fff url(/processwire4/site/assets/files/1008/) center center fixed no-repeat; -moz-background-size: cover; background-size: cover; } </style>
  19. I tried to figure this out looking at Ryan's snippet for sidebar inheritance and tried if and else statements using $page->parent->bkgimage but could never get it to work. In case I am not making myself clear, I just want child pages to show the same resizing full-screen background image as the parent. The code below works fine on a page by page basis. I have this style in the header of a template, which I don't like to do, but I don't know of any other way to get a full screen background like this: http://www.alistapart.com/articles/supersize-that-background-please/ <?php // if the current page has a populated 'sidebar' field, then print it, // otherwise print the sidebar from the homepage if($page->sidebar) echo $page->sidebar; else echo $homepage->sidebar; ?> <style> <?php foreach($page->bkgimage as $img) { echo "\nbody {\nbackground: #fff url({$img->url}) center center fixed no-repeat;\n-moz-background-size: cover;\nbackground-size: cover;\n}"; } ?> </style>
  20. Thanks Ryan, I got it to work in the loop, which is fine for one image, and great for more than one. <ul class='gallery'> <?php foreach($page->images as $img) { $diskpath = $img->filename; $exif = exif_read_data($diskpath, 0, true); $size = getimagesize($diskpath, $info); $iptc = iptcparse($info['APP13']); $t = $img->size(200); echo "<li><a class='gallery' title='{$t->description}' rel='group' href='{$img->url}' ><img id='dropshadow' src='{$t->url}' alt= width='{$t->width}' height='{$t->height}' /></a></li>"; echo "Title: " . $iptc["2#005"][0] . " <br />"; echo "Caption: " . $iptc["2#120"][0] . " <br /><br />"; echo "Shutter Speed: " . $exif["EXIF"]["ExposureTime"] . " <br />"; echo "Aperture: " . $exif["COMPUTED"]["ApertureFNumber"] . " <br />"; echo "ISO: " . $exif["EXIF"]["ISOSpeedRatings"] . " <br />"; echo "Camera: " . $exif["IFD0"]["Model"] . " <br />"; echo "Focal Length: " . $exif["EXIF"]["FocalLengthIn35mmFilm"] ."mm<br>"; echo "Photographer: " . $iptc["2#116"][0] . " <br />"; } ?> </ul>
  21. It seems as if this could be adapted to work... it does not use $config->paths->root, but it pulls all of the urls in the echo href statement. I know that this works. I just don't want a for each, or do I? <ul class='gallery'> <?php foreach($page->images as $img) { $t = $img->size(150, 125); echo "<li><a class='gallery' title='{$t->description}' rel='group' href='{$img->url}' ><img id='dropshadow' src='{$t->url}' alt= width='{$t->width}' height='{$t->height}' /></a></li>"; } ?> </ul>
  22. I am getting my IPTC and EXIF data to show up great with this code for a static single image. If I can build a template and get $filename to dynamically link to the path of a single image uploaded to a page, I can have a pretty simple gallery page that will display the image and the exported meta data. I have all of this data already in Aperture, so it would be great to use the IPTC data for keywords, titles and captions etc. I tried $image->url, but it is not working. Any help would be appreciated.Thanks. <?php // Point to image file $filename = "http://localhost:8888/processwire2/site/templates/styles/images/image.jpg"; $IPTC_Caption = ""; $size = getimagesize($filename, $info); if (isset($info["APP13"])) { if($iptc = iptcparse( $info["APP13"] ) ) { $IPTC_Caption = str_replace( "\000", "", $iptc["2#120"][0] ); if(isset($iptc["1#090"]) && $iptc["1#090"][0] == "\x1B%G") $IPTC_Caption = utf8_decode($IPTC_Caption); } } $exif = exif_read_data($filename, 0, true); echo "Title: " . $iptc["2#005"][0] . " <br />"; echo "Caption: " . $iptc["2#120"][0] . " <br /><br />"; echo "Shutter Speed: " . $exif["EXIF"]["ExposureTime"] . " <br />"; echo "Aperture: " . $exif["COMPUTED"]["ApertureFNumber"] . " <br />"; echo "ISO: " . $exif["EXIF"]["ISOSpeedRatings"] . " <br />"; echo "Camera: " . $exif["IFD0"]["Model"] . " <br />"; echo "Focal Length: " . $exif["EXIF"]["FocalLengthIn35mmFilm"] ."mm<br>"; echo "Copyright: " . $iptc["2#116"][0] . " <br />"; ?>
  23. No, I did not use Textile; I used the default TinyMCE. I think the text in 13a was how the tenant supplied the data and it came in like that on the CSV import. Now that you point it out, it does look a little awkward, so I think I will clean that up. Thanks for the heads up.
  24. My second Processwire site is a complete redesign of a Wordpress site: http://thecarterbuilding.com Also using the www.getskeleton.com framework to make the site look good across phones, tablets and large and small monitors. In fact, this site was designed first and foremost for mobile viewing, as many potential clients are more likely to discover this building by walking or driving by. (If you are viewing this site on a computer you can resize your screen to see it adjust to fit the window.) It was much easier to integrate this framework in Processwire than as a Wordpress theme. Also, Processwire was much better suited for the online directory than Wordpress was. I have all of the tenants as children under the Directory page, and although they don't show, thery are there, and can be developed into an expanded detail page if needed in the future. Used Ryan's CSV plugin to pump the pages in...Very nice and a HUGE saving of time. https://github.com/ryancramerdesign/ImportPagesCSV#readme Also the community is awesome. When I got stuck on my PHP coding of the directory page, several senior members had posted various solutions for me. Much thanks to Soma for rewriting my code (See: http://processwire.com/talk/index.php/topic,672.0.html) I think Processwire is the perfect solution for sites with staff directories or any other tabular data where you don't want your client to break the layout in a WYSIWYG edit window, which is very difficult to do in Wordpress. I have found some more advanced themes that make a good attempt, but the required shortcodes and backend edit-windows tend to overwhelm clients. (I have not totally ditched Wordpress for blog-centric sites.)
  25. Soma, Thanks for that clean code. It works great. It will be a while before I fully grasp what you have done since I am still so new to PHP.
×
×
  • Create New...