Jump to content

nikola

Members
  • Posts

    253
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by nikola

  1. Ryan, nice module! I always liked thumbnail preview rather than big images stacked one after another
  2. Ryan, I've made all of the changes you suggested and I've put the module in modules directory.
  3. Thanks for the follow up Martijn, I'll make the changes
  4. Hi guys, It's been a while that I've posted here on the forum, the reason was - I got a new job few months ago so I've been rather busy and haven't got time to post some new things. I've made a Yahoo! Weather module that connects to Yahoo weather API and pulls current forecast and forecast for next 4 days. The module is completely ready for translation, I've also made days and weather conditions translatable because Yahoo API doesn't offer localization (English only). The widget has normal mode and compact mode and you can easily customize it's appearance through included CSS. Edit 12.04.2015. This module is not longer supported, check out the new version at this link. I'll fix some errors that are currently in this module for those of you who like the old version better then the newer one. Screenshot Download https://github.com/nvidoni/MarkupWeather How to install Copy module directory to /site/modules/ directory. Click check for new modules in ProcessWire Admin Modules screen. Click *install* for the module labeled: "MarkupWeather". How to use Copy this line to template of your choice where you want the weather widget to be displayed: <?php echo $modules->get('MarkupWeather')->render(); ?> This module has the following options: Yahoo! Weather Woeid Woeid is a number located right beside the city name, e.g. http://weather.yahoo.com/croatia/grad-zagreb/zagreb-851128/ Set Locale sets PHP locale, needed for date display localization Date Format date formatted with PHP strftime function Show 5 day forecast below current weather forecast? turn this off if you want to display compact weather widget, shows only current weather Display temperature in Fahrenheit instead of Celsius? show weather conditions in Celsius or Fahrenheit scale Hope you'll like it.
  5. nikola

    Karena Savannah Cramer

    Congratulations Ryan! Wishing you and your family the best!
  6. Thanks diogo, will try it out during the weekend!
  7. Nice work diogo! Works like a charm! Would it be possible to have custom code in the page using admin template somehow? That way we could use that parent page for some actions in situations where children pages wouldn't be needed?
  8. Ryan, just wanted to say - thank you for this module, it will allow making multilanguage sites a breeze, I've used LanguageLocalizedURL module on some sites I've developed, but having it naturally in core, makes me wink
  9. @jsantari Wirebox is indeed intended for use in the backend only as a replacement for Fancybox, for the frontend you can use any lightbox that you prefer. @diogo I'll add this to documentation so it would be clear to new users.
  10. Thanks for the follow up, I've added admin template check, changes active on git.
  11. Thanks Antti, it's more like a newborn (cause it's not that so sophisticated ). If you find any bugs, let me know...
  12. After a few admin themes I've decided to make my first module. So, here it is, Wirebox module as replacement for Fancybox module for admin images and image galleries (modified jQuery Chocolat plugin and made it more "wire" friendly with some optimizations). I'm opened to suggestions how to make it better (how could it be improved?) as always UPDATE: optimized JS (removed unnecessary stuff, made the file smaller, optimized effects, resizing etc.) optimized CSS properly unbinds Fancybox click hooks from DOM before loading made the module configurable (you can set all the options through the module configuration screen) Screenshot: Info and download: http://modules.processwire.com/modules/wirebox/
  13. Currently I'm using repeaters and it works fine, but editor of the site asked me if it could be done that way to simplify things for them... h4 value would be applied to url segment as its name...
  14. Hi Ryan, sorry for the late reply. The source of URL segments I want to use is an article, let's say that I have an article on top o which I'm applying URL segments using my code above. So, I would like to use URL segments the way Soma explained for using with page numbers. So if I would have break on first H4, that would become article-name/first-segment-name, on second break it would become article-name/second-segment-name and so on...
  15. Although I'm satisfied how URL segments work (from my example), how can I do it with URL segments instead page numbers using Soma's code? This code work absolutely fine except that I want to add URL segment names sanitized to page URL (instead page(n) numbers) ... $bodyArray = preg_split("/(<h4>.+?<\/h4>)/", $page->body, 0, PREG_SPLIT_DELIM_CAPTURE); // get urlsegment pageNum, pageNum's needs to be turned on on template setting // returns 1 by default even if no urls segments set. $pnr = $input->pageNum; if($pnr == 1) { echo $bodyArray[$pnr-1]; } else { $pnrText = ($pnr-1)*2; $pnrSep = $pnrText - 1; echo $bodyArray[$pnrSep] . $bodyArray[$pnrText]; } // add link list to all text pages splited $count = (count($bodyArray)-1) / 2 + 1; for($i = 1; $i <= $count; $i++) { if($i == 1) { $title = "<h4>First Page</h4>"; } else { $title = $bodyArray[($i-1)*2-1]; } $class = ''; if($i == $pnr) $class = " class='active'"; echo "<a$class href='./page{$i}'>{$title}</a>"; }
  16. Soma, thanks for the answer!
  17. I have a front end login form and I would like to compare password that user inputs with the password in the system (database). How can I do it because password in database is hashed and salted so I can throw them an error if they put in the wrong password.
  18. I've sorted it out. The problem was with the array wrongly set up. It pulled page references that weren't needed at all. I wrapped it all up in a single function and automated categories and subcategories pulling with custom selectors for articles and it works fast and smooth Thanks for your help guys!
  19. Ryan, thanks for the answer. I've successfully updated the site from 2.2 to 2.3. It has lot's of articles (1000k+) and other pages including various page references. I've optimized the code through functions, solved some things that troubled me before with URL segments. The system has rewrite functionality for article URL's (I'm prepending categories and subcategories to article URL's and articles reside in one parent page) and so on... All seems to work well, and faster then before
  20. Thanks nik, I ended up with the code in the template itself in one big foreach that outputs the same code above and page executes in one second with all the extra code in header and footer. It looks like to me that it chokes somewhere when used through function...
  21. I had this structure in template before, but without the functions, and I repetead it manually and it worked fine and fast. Since I've made 3 function to do it automatically, page render slowed down dramatically (for now I have around 400 articles). I'm calling these 4 function 5 times on home page (for 5 different main categories). "kategorije" means "categories" // Article Header function homeHeader($category) { $category = wire('pages')->get("/kategorije/$category/"); foreach($category->children as $subcategory) { $subcategories[] = $subcategory->id; } $array = implode("|",$subcategories); $articles = wire('pages')->find("subcategory=$array, template=article, sort=-date"); echo "<a href='{$category->url}' class='all-categories'>Sve podkategorije</a>"; echo "<form class='category-select' method='get' action='#'>"; echo "<select name='category' class='selectyze' >"; echo "<option>Odaberi podkategoriju</option>"; echo "<optgroup label='Podkategorije'>"; foreach($category->children as $option) { echo "<option value='{$option->url}'>{$option->title}</option>"; } echo "</optgroup>"; echo "</select>"; echo "</form>"; echo "<h2><a href='{$category->url}'>{$category->title}</a> <span>(" . count($articles) . ")</span></h2>"; echo "<div class='clear'></div>"; } // Home Main Article function homeMainArticle($category, $start) { $category = wire('pages')->get("/kategorije/$category/"); foreach($category->children as $subcategory) { $subcategories[] = $subcategory->name; } $array = implode("|",$subcategories); $articles = wire('pages')->find("subcategory=$array, template=article, start=$start, limit=1, sort=-date"); foreach($articles as $article) { if(count($article->images) > 0) { $image = $article->images->first(); echo "<img class='align-left' src='" . $image->getThumb('bigthumb') . "' alt='{$image->description}' width='198' height='136' />"; } else { $image = "<img class='align-left' src='{$config->urls->templates}img/no-image-198-136.png' width='198' height='136' />"; echo $image; } echo "<h2><a href='{$article->url}'>{$article->title}</a></h2>"; $body = strip_tags(preg_replace("/(<h[1-6]>.*?<\/h[1-6]>|\[.*\])/m","",$article->body)); if (strlen($body) > 340) { $excerpt = excerpt($body, 0, 340); echo "<p>" . $excerpt . '<a href="' . $article->url . '"> više</a></p>'; } else { echo "<p>" . $body . "</p>"; } } } // Home Article function homeArticle($category) { $category = wire('pages')->get("/kategorije/$category/"); foreach($category->children as $subcategory) { $subcategories[] = $subcategory->name; } $array = implode("|",$subcategories); $articles = wire('pages')->find("subcategory=$array, template=article, start=2, limit=4, sort=-date"); foreach($articles as $article) { echo "<li>"; if(count($article->images) > 0) { $image = $article->images->first(); echo "<img class='img-left' src='" . $image->getThumb('thumb') . "' alt='{$image->description}' width='96' height='64' />"; } else { $image = "<img class='img-left' src='{$config->urls->templates}img/no-image-96-64.png' width='96' height='64' />"; echo $image; } echo "<a class='article-title' href='{$article->url}'>{$article->title}</a>"; $body = strip_tags(preg_replace("/(<h[1-6]>.*?<\/h[1-6]>|\[.*\])/m","",$article->body)); if (strlen($body) > 100) { $excerpt = excerpt($body, 0, 100); echo "<p>" . $excerpt . '<a href="' . $article->url . '"> više</a></p>'; } else { echo "<p>" . $body . "</p>"; } echo"</li>"; } } What could be wrong?
  22. This was discussed before: The password system has recently been updated. Problem is, I have around 300 accounts registered in PW as users that register from the front end of the site (site users). With the new password system, could they use their actual passwords they've set before without any troubles?
  23. That's great Ryan, I have one relatively big site that I'll upgrade to 2.3 so I'll let you know how it went.
×
×
  • Create New...