Jump to content

onjegolders

Members
  • Posts

    1,147
  • Joined

  • Last visited

  • Days Won

    4

Everything posted by onjegolders

  1. I might investigate this! Sounds like it may be the case will have to ask client. Cheers
  2. Thanks for the feedback also Ryan. The thing is these photos only need to be 800-900px max so I just need to sort out the client with an image resizing tool!
  3. Thanks Dave and Soma, is this just a case of trying to add more memory allowance on server or is it specific to resizing?
  4. I can't see anything related to it in the logs Dave but I'm thinking like you it could be something to do with memory. The thing is the equivalent backend images are not being scaled into thumbnails either, that must be relevant somehow? I see that I have: GD Version bundled (2.0.34 compatible)
  5. Yeah they were showing that on their filename but in the img tag the widths and heights weren't being set properly. It's strange as on one album it was the 10th photo onwards, on another it was like the 23rd and on other albums all the photos are fine, yet they all share the same field and same code. On the photos that display OK front-end, in the back-end they are displayed as thumbnails (I think - they are all much smaller size, though not identical) But the non-working photos display very large. Sorry but what is GD2? Can I check for it on phpmyinfo?
  6. Hi Apeisa, thanks for replying, here is the code: <?php foreach ($page->images as $image) { $thumb = $image->size(100,75); ?> <a href="<?php echo $image->url; ?>" class="lightbox" rel="<?php echo $page->title; ?>" title="<?php echo $image->description ?>"><img src="<?php echo $thumb->url; ?>" width="<?php echo $thumb->width; ?>" height="<?php echo $thumb->height; ?>" alt="<?php echo $page->title; ?>" class="small_frame" /></a> <?php } ?> I should point out that when I check in the admin, the full photos are showing too, not the thumbnails, but the "show thumbnails" option is ticked. This is the default images field that comes with PW. sorry, but yeah the resizing is only in the template
  7. I'm having a real issue here guys, my site's just gone live and the client has been adding some photos to the galleries. All looked great until I got further down and some of the images had not been resized (so were showing 3900px x 3000px or something similarly terrifying). All the images are just in a foreach loop and the vast majority of the images are getting correctly resized but once one is not resized, all subsequent ones follow suit and are also not resized. I can upload code, but has anyone else seen or heard of a similar issue? Sorry for the desperation but it's sort of making the website look insane
  8. I seemed to have got it sort of working by using an $out variable to avoid outputting content before the logic. I'm still having some issues with the redirects though. With $session->redirect('./'); I get sent straight back to my login page, I eventually tried ../ and that seemed to do the trick but not quite sure why? Also, ideally I would like to be able to send them to the page they were on before heading to the login page, though I'm not sure if that is possible?
  9. Thanks Ryan, as you can see in the login.php, I am including a redirect: <?php if($input->post->login_submit) { // process submitted login form $name = $sanitizer->username($input->post->login_name); $pass = $input->post->login_pass; if($session->login($name, $pass)) $session->redirect("./"); else echo "<h2>Login failed, please try again.</h2>"; } else { // display the login form include("./login_form.inc"); }
  10. The link does go to another template where the logic does appear before any html (see login.php above) but the link itself on header.php is obviously within the page's html. Is this not possible, just wondering how other people manage their logins? Thanks again Diogo for helping
  11. Thanks Diogo, but as I'm calling the login template from a link that someone clicks in ul#login, is it even possible to link to this before any output?
  12. Hi Ryan, thanks for the help I seem to have it working now, the limit=1 was just to try and start off pagination as a test because I only had 2 articles for any given category, but have now upped that and all seems well.
  13. I'm not quite sure how to avoid it to be honest. I have login links in the top area of my page, ie: somewhere after the logo, which when clicked opens the login template. How could I arrange it so that this was at the top of my page? Here is my header.inc to explain better perhaps: <?php if($input->get->logout) $session->logout(); ?> <!DOCTYPE HTML> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="description" content=""> <meta name="description" content=""> <title>Site name | <?php if ($page->rootParent->title != $page->title) {echo $page->rootParent->title . " | ";} ?><?php echo $page->title; ?></title> <!-- stylesheet(s) --> <link rel="stylesheet" type="text/css" href="<?php echo $config->urls->templates?>styles/style.css" /> <link rel="stylesheet" type="text/css" href="<?php echo $config->urls->templates?>scripts/colorbox.css" /> <!-- scripts --> <script src="<?php echo $config->urls->templates?>scripts/jquery.js" type="text/javascript"></script> <script src="<?php echo $config->urls->templates?>scripts/cycle.js" type="text/javascript"></script> <script src="<?php echo $config->urls->templates?>scripts/colorbox.js" type="text/javascript"></script> <script src="<?php echo $config->urls->templates?>scripts/scripts.js" type="text/javascript"></script> <!-- fonts --> <!-- Typekit --> </head> <body> <div id="container"> <div id="top" class="black_gradient"> <div id="logo"> <h1><a href="<?php echo $config->urls->root; ?>">Site name</a></h1> <h4>Tel: 01234 567 890</h4> </div><!-- /#logo --> <ul id="login"> <?php if ($user->isLoggedin()) { ?> <li><?php echo $user->name; ?></li> <li><a href="./?logout=1">Logout</a></li> <?php } else { ?> <li><a href="<?php echo $config->urls->root; ?>login" class="login">Sign-in</a></li> <li>Register</li> <?php } ?> </ul><!-- /#login --> <ul id='nav'><?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='active'" : ''; echo "<li><a$class href='{$child->url}'>{$child->title}</a></li>"; } ?></ul> <div class="clear"></div> </div><!-- /#top -->
  14. Hi guys, have been having an issue with pagination. It's a bit odd, I have it working fine as per Ryan's docs but when I get to a page2 of results, my categories don't display. I should add that my categories are generated at the top of the page in their own loop. The template also uses urlSegment to filter the results by category. I have added pagination to both the news template and also the categories template which get's called through urlSegment. On the main news page, pagination works but the categories come up empty when on the 2nd page. On the categories template, the pagination won't show at all, and I'm not sure why as it's pretty much an identical setup to the news template. Here's all the code, in case any of you can make sense of it.... Thanks. News index : <?php include("./header.inc"); ?> <div id="news_index" class="grey_gradient"> <?php if ($input->urlSegment1 !="") { include ("./categories.php"); } else { ?> <div id="news_top_bar"> <h5 id="news_header">Recent news items</h5> <?php $news_cats = $pages->find("template=news_category"); if ($news_cats) { ?> <ul id="news_cats"> <li>By category: </li> <?php foreach ($news_cats as $cat) { $numArticles = $pages->count("template=news_entry, news_category_link=$cat"); if ($numArticles > 0) { ?> <li><a href="<?php echo $page->url . $cat->name; ?>"><?php echo $cat->title; ?></a> / </li> <?php } ?> <?php } ?> </ul> <?php } ?> <div class="clear"></div><!-- /.clear --> </div><!-- /#news_top_bar --> <?php $news = $page->children("sort=-created, limit=3"); foreach ($news as $entry) { $class = "news_box"; if ($entry == $news->last()) { $class .= " news_box_last"; } ?> <div class="<?php echo $class; ?>"> <div class="news_index_text"> <h3><a href="<?php echo $entry->url; ?>"><?php echo $entry->title; ?></a></h3> <h6><?php echo $entry->entry_date; ?> by <?php echo $entry->createdUser->first_name . " " . $entry->createdUser->last_name; ?></h6> <?php if ($entry->summary) { echo "<p>" . $entry->summary . "</p>"; } else { $body_text = strip_tags($entry->body); $text = substr($body_text, 0, 300); echo "<p>$text...</p>"; } ?> <a href="<?php echo $entry->url; ?>" class="button">Read on</a> </div><!-- /.news_index_text --> <?php if ($entry->main_image) { $news_image = $entry->main_image->size(240,180); ?> <img src="<?php echo $news_image->url; ?>" width="<?php echo $news_image->width; ?>" height="<?php echo $news_image->height; ?>" alt="<?php echo $entry->title; ?>" class="small_frame" /> <?php } ?> <div class="clear"></div><!-- /.clear --> </div><!-- /.news_box --> <?php } ?> <?php // PAGINATION LINKS $pagination = $news->renderPager(); echo $pagination; ?> <?php } ?> </div><!-- /#news_index --> <?php include("./footer.inc"); ?> Categories.php : <?php $name = $sanitizer->pageName($input->urlSegment1); $category = $pages->find("template=news_category, name=$name"); $news_cats = $pages->find("template=news_category"); ?> <div id="news_top_bar"> <h5 id="news_header">Recent news items - <?php echo ucwords($name); ?></h5> <?php if ($news_cats) { ?> <ul id="news_cats"> <li>By category: </li> <?php foreach ($news_cats as $cat) { $numArticles = $pages->count("template=news_entry, news_category_link=$cat"); if ($numArticles > 0) { ?> <li><a href="<?php echo $page->url . $cat->name; ?>"><?php echo $cat->title; ?></a> / </li> <?php } ?> <?php } ?> </ul> <?php } ?> <div class="clear"></div><!-- /.clear --> </div><!-- /#news_top_bar --> <?php $news = $pages->find("template=news_entry, news_category_link=$category, limit=1"); foreach ($news as $entry) { $class = "news_box"; if ($entry == $news->last()) { $class .= " news_box_last"; } ?> <div class="<?php echo $class; ?>"> <div class="news_index_text"> <h3><a href="<?php echo $entry->url; ?>"><?php echo $entry->title; ?></a></h3> <h6><?php echo $entry->entry_date; ?> by <?php echo $entry->createdUser->first_name . " " . $entry->createdUser->last_name; ?></h6> <?php if ($entry->summary) { echo "<p>" . $entry->summary . "</p>"; } else { $body_text = strip_tags($entry->body); $text = substr($body_text, 0, 300); echo "<p>$text...</p>"; } ?> <a href="<?php echo $entry->url; ?>" class="button">Read on</a> </div><!-- /.news_index_text --> <?php if ($entry->main_image) { $news_image = $entry->main_image->size(240,180); ?> <img src="<?php echo $news_image->url; ?>" width="<?php echo $news_image->width; ?>" height="<?php echo $news_image->height; ?>" alt="<?php echo $entry->title; ?>" class="small_frame" /> <?php } ?> <div class="clear"></div><!-- /.clear --> </div><!-- /.news_box --> <?php } ?> <?php // PAGINATION LINKS $pagination = $news->renderPager(); echo $pagination; ?> I've just re-read part of the pagination docs here and have added "start=0, limit=n" to my news_index template so now categories are showing even on 2nd page. Still can't seem to get pagination showing on categories template though
  15. Hiya Ryan have been trying to extend my login somewhat. I now have a login form opening in a modal box: <ul id="login"> <?php if ($user->isLoggedin()) { ?> <li><?php echo $user->name; ?></li> <li><a href="./?logout=1">Logout</a></li> <?php } else { ?> <li><a href="<?php echo $config->urls->root; ?>login" class="login">Sign-in</a></li> <li>Register</li> <?php } ?> </ul><!-- /#login --> this part works fine. Here is my login.php and login_form.inc templates as per another of your posts: Login.php <?php if($input->post->login_submit) { // process submitted login form $name = $sanitizer->username($input->post->login_name); $pass = $input->post->login_pass; if($session->login($name, $pass)) $session->redirect("./"); else echo "<h2>Login failed, please try again.</h2>"; } else { // display the login form include("./login_form.inc"); } Login_form.inc <form action="./" method="post" id="login_form"> <label for="login_name">Username</label> <input type="text" name="login_name" autofocus> <label for="login_pass">Password</label> <input type="password" name="login_pass"> <input type="submit" id="submit" name="login_submit" value="login"> </form> The problem I noticed was that when I'm returned to the home page, it still shows "sign in" (indicating that the form didn't work). Would you have any ideas why it may not be working? Thank you again.
  16. Thanks for the replies, think I may have just misunderstood, when I select with the datepicker it displays YYYY but when saved it reverts to desired input.
  17. Thanks Ryan, I have actually already installed this version, will have to double check whether it works as am pretty sure it still defaults to YYYY
  18. Thanks Ryan, seems to be working fine now
  19. I'm trying to get started on user logins. I have read quite a few topics but came up against a small problem. On my header.inc file I have the following code: <ul id="login"> <?php if ($user->isLoggedin()) { ?> <li>Welcome, <?php echo $user->name; ?></li> <li><a href="<?php $session->logout(); ?>">Logout</a></li> <?php } else { ?> <li><a href="<?php echo $config->urls->admin; ?>">Sign-in</a></li> <li>Register</li> <?php } ?> </ul><!-- /#login --> My only aim at the moment is that once logged-in the site will know that the current user (session?) has certain permissions so that when they click on "member-only" pages they will have access. Currently I can get them to login via the admin backend (I may want to change this to my own custom login template) and then the page they are on shows "Welcome, username) so they are logged-in, however when I click to another page they seem to be logged-out again? Is this default behaviour? Should I be going about this in a different way? Thanks guys.
  20. Thanks Jasper for your help. I've switched it to dashes and it all works now. Unfortunately the datepicker reverts it to YYYY-MM-DD but I understand there's no real way around that and it's not too big a deal!
  21. Not sure whether this is a known bug or something else is causing the problem. Basically my custom date field is being wiped when I resave the page. So on first adding the date and saving all is well, or if the date is added last thing before clicking save then no problems but otherwise the datefield just empties. I am also using the datepicker (not sure if this has any bearing on it)
  22. Thanks Soma, I ended up setting a count variable and a total variable and matching the two.
  23. Sorry Ryan, perhaps a dumb PHP question, in your template example, what's the easiest way to remove the last > from the breadcrumbs?
  24. Thanks Ryan that works perfectly, have a nice evening!
×
×
  • Create New...