Jump to content

alexm

Members
  • Posts

    710
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by alexm

  1. Ah ok! I'll address this thanks Martijn
  2. Ok! typo. They are rendering with images. However the <p>Couldn't find director.</p> doesn't show when setting a user that doesn't exist. I'll have to take a look into that. It's working though! Thanks teppo and WillyC
  3. So you were both right that one of the directors didn't have an image assigned which was breaking it. So I have amended the code but now the director with no image renders now with no image of course and then it fails and throws an error for the last two. If I change the usernames to one's which don't exist nothing displays at all and nor does the <p>Couldn't find director.</p> message. I'm confused
  4. Hi Teppo, I'm just being lazy when I say equivalent. Here is what it looks like so far function renderDirectorProfile($person) { if ($person) { $director = wire('users')->get("name=$person"); $directorsImage = $director->images->first(); $o .= "\n<div class='member span4'>" . "\n\t<img src='{$directorsImage->size(369, 369)->url}' alt='$director->fullname' />" . "\n\t<h2>$director->fullname</h2>" . "\n\t<span='position'>$director->position</span>" . "\n\t$director->body" . "\n</div>"; } else { $o = "<p>Couldn't find director.</p>"; } return $o; } Thanks
  5. Hi Guys, Just wondering whether I'm doing something wrong or you just can't use size function for images inside of my global functions.php. I have an about page and on this page am going to render directors of the company. So I have made a function so as not to keep rewriting the same code of course. If I use: $alex = $users->get("name=alex"); $image = $alex->images->first; echo "<img src=\"{$image->size(369, 369)->url}\" />"; from within the about template there is no problem at all. Now if I do the equivalent from within the functions file I get: Error: Call to a member function size() on a non-object (line 249 of /Path/To/My/Website/site/templates/includes/functions.php) Any thoughts please? Thanks Alex
  6. That's another killer idea. Ok i'll take a look at this for future reference!
  7. renobird, diogo... Thank you both so much for your help! diogos method works a charm as I'm sure would yours renobird, like you say it's just a bit cleaner for the purpose of what I want to achieve. You are both legends. What a lovely forum full of caring people!! Thanks again
  8. Sorry I'm telling a porky pie. If I set include=hidden that breaks it.
  9. Correct. As it stands if I change a child page of home to hidden it breaks the homepage that pulls in the children and redirects to domain.com/page/ with the page not found message.
  10. I have a home.php file with basically the head and the footer and elements which are static. Then where I'm pulling in the pages with their templates assigned I'm literally using that code already posted <?php foreach ($page->children() as $p) { echo $p->render(); // render the pages } ?> Then in each template there is just your usual eg. <section class="arrow" id="<?php echo pageIdAttr($page->url); ?>"> <div class="container inner"> <div class="thin"> <div class="section-title"> <h2><?php echo $page->title; ?></h2> </div> <div class="row"> </div> <!-- /.row --> </div> </div> </section> <?php echo renderTestimonial($pages->get(1002)->testimonial_repeater, 0, 'yellow', $config->urls->templates); ?> Thanks
  11. Your logic in post #7 seems like the right idea to me but it's just not happening. Oh well.
  12. Hmm still as soon as I add include=hidden it just breaks the homepage and redirects to domain.com/page/ with the page not found message. Perhaps I should just use an after hook to redirect. I dunno. My heads not in it either right now. Coffee didn't help me, ha!
  13. Yea it's odd, because when I do that I get the page not found message on the home page.
  14. @joss it's more a case of tidiness etc. @renobird - thanks for the welcome. I don't think I made myself very clear. Sorry. The nav works fine. But Im using the separate pages on the backend as sections of a one page design. Now as these are pages I can still access them via their URL's. As Joss points out this probably won't matter if there are no links to the page but I'm just wondering out of interest if there is a way of showing the hidden pages within my loop which grabs the different pages as sections of the one page design? If not it's not a massive deal I guess, but more of a thought. Thanks guys, sorry about the delayed reply, didn't get a notification of replies. I'm now following the topic so I guess I should.
  15. Hi guys, New to the forums so I'm looking forward to having some great discussions. First off, I'd obviously like to say what a great CMS/F, very neat and tidy and super simple to use. Nice one Ryan. And secondly the community looks great. Hopefully someone can help me with this... I see other similar topics on the forums but none that clear up this point. I have a one page site. I have used child pages of home as the different sections of the one page site. This populates MarkupSimpleNavigation with the menu system for the one page site as more sections are generated. That's perfect. Now however lets say there is an about page. If I browse to domain.com/about/ I would like to hide the page and return 404. As this page is being pulled in by the home page. And shouldn't be accessible via url. Now the problem is I have templates assigned to each child page for obvious styling reasons so I can't create a page without a template file assigned. How can I show hidden pages on the home page? I have in my home.php template foreach ($page->children() as $c) { echo $c->render(); // render the pages } where I want to render each other page and template. if I try to add foreach ($page->children("include=hidden") as $c) { echo $c->render(); // render the pages } I get redirected to domain.com/page/ with the following message: "The page you were looking for was not found" "Please use our search engine or navigation above to find the page" Could anyone shed any light on how I might go about solving this? I don't mind having the pages hidden on the backend so this solution would be fine if it worked. Thanks, Alex
×
×
  • Create New...