Jump to content

RichyRich

Members
  • Posts

    9
  • Joined

  • Last visited

Everything posted by RichyRich

  1. I have done much searching, and my terminology could be off but here is what I am looking to learn... How do I get processwire and lets say a ecommerce app, to share the same user data? I am sure this can get more than simple, but just looking for a starting point. Thanks again!
  2. I gave up on the idea. It is messy, but I ended up putting function in template PHP. Works that way. I just rather not have it all spit up into different files. Hard to imagine this being a common bug
  3. in _func.php is namespace ProcessWire; Same errors when given fix was attempted.
  4. Okay folks, I am trying to put a character limit on a body of text. I am using the following function, which is place in the _func.php file: function wordLimiter($str, $limit = 120, $endstr = '…'){ $str = strip_tags($str); if(strlen($str) <= $limit) return $str; $out = substr($str, 0, $limit); $pos = strrpos($out, " "); if ($pos>0) { $out = substr($out, 0, $pos); } return $out .= $endstr; } This works just fine on it's own. When placed in Hanna code I get a fatal error, "Call to undefined function wordLimiter()". Code in hanna <?php echo "<div class=\"grid_xs-1\">"; foreach ($pages->find("template=property") as $properties) { //attempt at defining $summ to call wordLimitor() $summ = wordLimiter($properties->body); echo " <div class=\"col-5 card property\"> <a href=\"{$properties->url}\"> <img src=\"{$properties->images->first->size(500,500)->url}\"> </a> </div> <div class=\"col-7\"> <h3>{$properties->title}</h3> <p>{$summ}</p> </div> <div class=\"col-12 grid details\"> <div class=\"col\"> <i class=\"fa fa-dollar\" aria-hidden=\"true\"></i> {$properties->price}</div> <div class=\"col\"> <i class=\"fa fa-bed\" aria-hidden=\"true\"></i> {$properties->bedroom}</div> <div class=\"col\"> <i class=\"fa fa-bath\" aria-hidden=\"true\"></i> {$properties->bathroom} </div> <div class=\"col\"> <i class=\"fa fa-arrows\" aria-hidden=\"true\"></i> {$properties->square_feet} SqFt</div> </div>"; } echo "</div>"; I have also tried placing the function wordLimiter() at the top of the Hanna but it give a different error, " Cannot redeclare wordLimiter() " Am I missing something here? Limitation somewhere?
  5. Your posts had lead me to the conclusion! It is simple... I'm an idiot. Processwire was expecting an image on every blog post page. I did not have an image set on everyone one. Now it is... foreach($pages->find("template=blog-post, limit=12, sort=-blog_date") as $child) { if(is_object($child->blog_images->first)) { $featureImage = $child->blog_images->first->size(400,200); } else { $featureImage = NULL;} $content .= " <div class=\"col-3\"> <img src=\"{$featureImage->url}\"> <a href=\"{$child->url}\">{$child->title}</a> </div>"; } with NULL just a placeholder till I find some thing more suitable. I came from MODx and I have to say that the processwire is awesome. I hope to contribute one day.
  6. I have looked into this for some hours, and done plenty searching. I have had something similar executed successfully. But this code returns " Error: Call to a member function size() on a non-object ". If I leave out size() image displays, albeit, too big. Here is code... foreach($pages->find("template=blog-post, limit=12, sort=-blog_date") as $child) { $content .= " <div class=\"col-3\"> <img src=\"{$child->images->first->size(200,200)->url}\"> <a href=\"{$child->url}\">{$child->title} </a> </div>"; }
  7. Just installed now get this error on the back end. I am guessing PHP version related?
  8. Thank you for a response kongondo & abdus. Yea I realize $blog is not being used. I would like /blog to display 10 blog posts, I am having trouble on how to render the links to the next 10 posts, or a list of categories using $blog. Regarding the issues with navigating pages of 10 blog post, I started writing that myself, but I think it is a waste of time considering I am sure it can be called using $blog
  9. I am finding myself having to deconstruct everything. I am not having an easy time. I am sure I am approaching this wrong. Every step I have overcome has not been without a struggle. So I want to present the blog posts within the current sites html. So I created my own blog.php with the following code <?php $blog = $modules->get("MarkupBlog"); foreach($pages->find("template=blog-post, limit=10") as $child) { $content .= " <div class=\"pure-u-lg-1-3 pure-u-md-1-3 pure-u-1-1\"> <a href=\"{$child->url}\">{$child->title}</a> <img src=\"{$child->blog_images->first->url}\"> </div>"; } This works just find. Then I think well when site.com/blog displays the blog post now how do I call the previous and next markup? I believe I have to use the function $blog->renderNextPrevPosts(). Like I said, I am probably approaching this wrong.
×
×
  • Create New...