Jump to content

Sergio

Members
  • Posts

    531
  • Joined

  • Last visited

  • Days Won

    11

Everything posted by Sergio

  1. For simple static sites you can use a javascript based approach like http://lunrjs.com/ Also, check https://www.algolia.com/ for a more powerful solution, although in this case a more complex solution to implement depending on your needs.
  2. Also check this code example where Ryan shows how to create pages using the API. It's pretty simple!
  3. I don't have a code example for this, but if you look at these two modules by Ryan, you can do it: http://modules.processwire.com/modules/markup-rss/ http://modules.processwire.com/modules/rss-feed-loader/ And schedule the export/import with http://modules.processwire.com/modules/lazy-cron/ Also check this module: https://processwire.com/blog/posts/introducing-iftrunner-and-the-story-behind-it/#iftrunner-release
  4. Are both sites on the same server? If yes, what about letting people make new pages on the new site and, using the API, you can export these pages as XML and import them on the old db every night. Or you could hook on the page save on the new site and fire a cron job to create the page on the old db as well.
  5. No need, @Cesco. You can do this on your current installation. To use Italian as your default language on the frontend, and considering your want "example.com/" to open in Italian and "example.com/en/" to change to English, do the following: As this is a new installation, and you have no real data yet, delete all languages but the default one, of course. Change the default language title to Italiano Upload Italian translation files to it Create a new language, name "en", title "English" Edit the homepage and set the "en" language as active and the url as "en".
  6. I have 4728 users right now on my project. No problem so far.
  7. It's better in a way. You have SSL support, which could be a pain in the ass to configure and maintain. Server Pilot free plan does not have SSL enabled. So, $12.49 one time payment is a very nice deal.
  8. Looks like a timesaver app, @szabesz! I think I'm gonna buy it. Thanks for the tip!
  9. You can have something like this, considering your page field is called "categories". Not tested! <?php $categories = $pages->find('parent=/categories/, sort=name'); ?> <?php foreach ($categories as $category) : if ($pages->count("categories=$category")) > 0 : ?> <li><a href="#" data-name="<?php echo $category->name; ?>"><?php echo $category->title; ?></a></li> <?php endif; endforeach; ?>
  10. And if the course options (like Adult Courses) are going to be just options, not entire page (with fields), you can use the Options fieldtype as well.
  11. @Tyssen , if you decided for this approach of caching the xml, you can see how I've done this when I was getting info from Slideshare using GuzzleHttp client. use GuzzleHttp\Client; public function getSlideshows() { $client = new Client([ // Base URI is used with relative requests 'base_uri' => 'https://www.slideshare.net/api/2/', // Set timeout. 'timeout' => 35.0, //Slideshare was taking long 35 seconds to respond. The xml has 100+ items. ]); $api_key = 'xxx'; $username = 'xxx'; $time = mktime(date("H")); $secret = 'xxx'; $sha1 = sha1($secret].$time); $cache = wire('cache'); $response = $cache->get("slideshare_xml"); //save and cache the xml if(!$response) { $url = $client->get('get_slideshows_by_user?username_for='.$username.'&detailed=1&api_key='.$api_key.'&ts='.$time.'&hash='.$sha1); $response = $url->getBody(); $cache->save('slideshare_xml', $response); //default is 24h } $xml = new \SimpleXMLElement($response); echo $xml; // $slide["secret_key"] = (string) $xml->Slideshow->SecretKey; // $slide["title"] = (string) $xml->Slideshow->Title; // $slide["description"] = (string) $xml->Slideshow->Description; // $slide["url"] = (string) $xml->Slideshow->URL; // $slide["thumbnail_url"] = (string) $xml->Slideshow->ThumbnailURL; // $slide["embed_url"] = (string) $xml->Slideshow->SlideshowEmbedUrl; // $slide["created"] = (string) $xml->Slideshow->Created; // $slide["language"] = (string) $xml->Slideshow->Language; // $slide["num_views"] = (int) $xml->Slideshow->NumViews; }
  12. Indeed @Sephiroth, I forgot to think about that. A cache should suffice in this case.
  13. Is the data from the XML needed to be shown in real time? I'm mean, does it change A LOT every minute or so? I don't think so, as is not an auction site apparently. So I think is a good idea to import the data as PW pages and using a cron job or manually import only the fields that changed on a daily update and import new items if not created already.
  14. I've read people talking about how painless ottomatik.io is to restore so I decided to give it a try. Prior to it I was using a local script and also backing up the entire DigitalOcean droplet but decided to use another system, after reading about DigitalOcean losing an entire server backup history. My sanity deserves the $10/month.
  15. For documents such as PDFs, you can use the S3 options you already talked about to store them there, because you'll only need the file URL after all. Remember to config Processwire to store the session on the database.
  16. Never done it myself, but I know it's possible to decouple the image processing and keep the goodies on an API for manipulation, similar to PW's. You can take a look at Cloudinary feature to upload an image by its URL. Also, there's IMGIX .
  17. @Robin S's code is an excellent approach, @j00st! The ConnectPageFields module is great to have the admin user manage the relations is a much easier way. I have to implement it on this site the screenshot came from yet, as when I developed these connections the module wasn't available. As for your question, the code I used to create this page shown on the screenshot is taken from Ryan's blog profile tag template, mine version is below: /** * Generate a list of tags A-Z * * Used by the /site/templats/tags.php template file. * * VARIABLES: * ========== * $tags PageArray of tags * * Each of the tags has a numPosts property containing the number of posts used by the tag. * */ $lastLetter = ''; $out = ''; $letters = array(); $tags = $page->children(); foreach($tags as $tag) { $letter = strtoupper( substr( $sanitizer->pageName($tag->title, true) , 0, 1 ) ); if($letter != $lastLetter) { if($lastLetter) $out .= "</ul></div>"; $out .= "<div class='letter-group'>"; $out .= "<h3 id='letter_$letter' class='bg-tags text-center'>$letter</h3>"; $out .= "<ul class='no-bullet'>"; $letters[] = $letter; } $lastLetter = $letter; $page_count = $pages->count("tags=$tag"); $class = $page_count >= 10 ? 'u-strong' : ''; if($page_count > 1) { $out .= "<li class={$class}><a href='{$tag->url}'>{$tag->title} <span class='color-tags-dark25'>({$page_count})</span></a></li>"; } } $out .= "</ul></div>"; /I'm using TemplateLatteReplace module to outup to a view file. $view->letters = $letters; $view->tag_list = $out;
  18. Hi @j00st, do you mean something link the screenshot below?
  19. Just a small correction on @Robin S code: If you're using PW 3.0+ will need to reference the PDO class outside ProcessWire namespace: $ids = $query->fetchAll(\PDO::FETCH_COLUMN); Or, put this in the beginning of the file: <?php namespace ProcessWire; use \PDO;
  20. On my current project I decided to keep the .php extension but on the next one I'll enjoy this new approach for sure. Many thanks, @tpr !
  21. As you are stuck with AWS, check this tutorial on their site, explaining how to host a Wordpress site: http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/php-hawordpress-tutorial.html#php-hawordpress-tutorial-launch
  22. Ryan, it looks really great indeed! A great improvement on the theming capabilities! Looking forward to create a dark theme on it!
  23. If you really need Apache, you need to install it yourself via ssh. Processwire runs fine in Nginx.
  24. Maybe you can try https://forge.laravel.com/, from the author of the Laravel framework. I use it for my DigitalOcean droplets and it's great! You can use it to setup a server on Amazon, Linode or with a custom VPS too.
  25. Excellent post, thanks for sharing @szabesz! I recently reset one of my Macbooks and I did almost all described in that post, but I've followed Jeffrey Way's free videos on https://laracasts.com/series/setup-a-mac-dev-machine-from-scratch . Great resource too!
×
×
  • Create New...