Jump to content

Sergio

Members
  • Posts

    531
  • Joined

  • Last visited

  • Days Won

    11

Everything posted by Sergio

  1. Yes, by using textdomains: https://processwire.com/api/multi-language-support/code-i18n/#technical-details
  2. Cool! I didn't know that's possible.
  3. @manlio, maybe this thread will help you:
  4. I tried this module today to output a video preview from a multilanguage field. Worked like a charm. See the screenshot. I created two fields, one for the default language (English) and one for Portuguese. Here's the code for both, if someone's interested: English field: return '<iframe src="https://www.youtube.com/embed/'.$page->youtube_id.'/?showinfo=0&amp;iv_load_policy=3&amp;controls=1" frameborder="0" allowfullscreen width="100%"></iframe>'; Portuguese field: //1021 is the 'portuguese' language page id $youtube_id = $page->youtube_id->getLanguageValue(1021); return '<iframe src="https://www.youtube.com/embed/'.$youtube_id.'/?showinfo=0&amp;iv_load_policy=3&amp;controls=1" frameborder="0" allowfullscreen width="100%"></iframe>'; Thanks @kongondo for this great module!
  5. I recently discovered an app that maybe help you on that, it's called Blackfire https://blackfire.io See a screenshot of an example from its website. Install on your server (or local) and give it a try and maybe compare with @teppo's diagram above. Edit: this is a Symfony app, and not mine, just to clarify.
  6. @Elías Gómez, great that you sorted that out!
  7. The image field default setting is to output an array, so if you only want to output one image of the page, try on your loop: $event->images()->first()->url;
  8. Olá! I did that on my installation (EN, the default, and PT) and, after I changed the language on my profile to Portuguese, I opened a page to edit it and the translation appeared. Which PW version are you using? Mine is 3.0.39.
  9. Using the language files search box, I've found the culprit at the ProcessPageEdit.module file. You need to translate two strings there, 'Save' and '%s + Next'. %s will be replaced with the translation of 'Save'.
  10. Anyone else will be attending WebSummit this week in Lisbon? I arrived here yesterday. Any ProcessWire lisboeta friend wanna grab a beer and talk about PW?
  11. That's a cool approach too, @teppo, although requires a bit more work and, as you already said, there's a downside on the flexibility of having a custom table. I already implemented @BitPoet suggestion. I created a module with a couple of methods and a custom table. Now I'm working on using PWCron module to run the nightly job.
  12. Yes, that's it. This is a fully functional code example: //pageviews.php receives a ajax get passing $page->name as querystring //Ex: example.com/pageviews.php?path=/videos/title-of-video/ //First, check if there is a querystring and find the page with it if(($path = (string) $input->get->path)) { $path = $sanitizer->selectorValue($path); $p = $pages->getByPath($path); if($p->id && $p->fields->has('page_views')) { // page was found and it has a 'page_views' field $key = "pageview" . $p->id; if(!$session->$key) { // pageview not yet recorded for this page for this user session $p->setOutputFormatting(false); $p->page_views++; $p->save('page_views'); $log->save("pageviews", $p->id); //optional, just if you want see it in the logs on Admin $session->$key = "pageview" . $p->id; //register in session so a reload will not trigger a pageview for the same user } } } else { //no querystring on url, so lets avoid any problems throw new Wire404Exception(); }
  13. Saving a field on a page is different than saving the whole page itself. That's why. The field lives on its own table, and has a pages_id column pointing to the page.
  14. "To master git, one has to live many lives" – Confucius Is indeed very hard to understand it beyond the basics. I sure don't. One good resource that I can recommend is this course by Jeffrey Way on his Laracasts: https://laracasts.com/series/git-me-some-version-control He is an excellent teacher, I can't recommend him enough. Take a look at all courses there, you won't regret.
  15. That's an interesting approach too, @BitPoet ! Thanks!
  16. Hi SamC, Processwire does not create a CSS cache. This is done by your browser and/or the server (in this case, Dropbox). The technique you used to see the new file, by appending a query string in the filename, in this case "?a=1", is one of the things that trigger an instruction in the browser to make it download the file again. You can read more about this in this post https://css-tricks.com/strategies-for-cache-busting-css/ And regarding keeping the site copies in sync between your computers, although Dropbox works, it's not a good practice because you can't track changes on the files and risk losing some of the work done in eventually sync error. It is recommended that you use a version control system for this. Best, Sergio
  17. Folks, I'm wondering if I could have problems with the following setup, any ideas welcome! The problem: Setup a page counter with Procache The project I'm working on has page views in the DB since 2007. I'm migrating from Wordpress. For some reasons not discussed here, these pages views are different than the number of views from Google Analytics. So, I have two fields on each page, page_views and ga_views. Since I'm using Procache, I created an Ajax page that handles the increment of page_views. Works like a charm, but of course, the page is cleared from the cache as soon as the field gets updated. I was planning to use Redis for this, store the pages views in it and create a Cron job to retrieve then each night. But I was reading the PW's $log docs today and decided to try and store the page views as a log entry (using Text => $page->id). So, I created a template to get the entries, sum them by page id and increment the page_views field. After that, I delete the log. Currently, the website (still running in WP) has about 1500-2000 page views per day. Do you guys think that I can have problems with this setup regarding disk I/O on the server, for instance? I'm still thinking about using Redis in the future, but I have to learn it a little bit more and the project is on a tight schedule. So I thought about this as a preliminary solution.
  18. Hey @netcarver, any updates on this module? Is it available? I'd like very much to try it in a project here.
  19. Welcome to the forums, @leegold ! I think you're going to like the tutorials by @benbyf, published on https://tutsplus.com/authors/ben-byford
  20. I tried https://cse.google.com/cse/publicurl?cx=014789015761400632609:fxrf0rj4wr4&q=repeater and it worked. Note that q is the second parameter, so use &q=some+keywords.
  21. You're welcome! And do stick around! You're going to love PW. And to help you on future searches, a tip: Add this link to your bookmarks, it's a Google custom search on the forums: https://cse.google.com/cse/publicurl?cx=014789015761400632609:fxrf0rj4wr4
  22. Welcome to the forums, @Praxea ! It seems a common .htaccess issue, please take a look on this post: https://processwire.com/docs/tutorials/troubleshooting-guide/page3
  23. @tpr I'm wondering what benefits do you seek to achieve in GC? Could you explain a little bit more?
  24. Quick question: are URL segments allowed in the template settings?
  25. Agree, but wouldn't be better to check this after the regex has matched, something like this, for instance: $year_url_segment = $sanitizer->selectorValue($input->urlSegment); $years_on_database = range(date("Y"),2007); //Range of years from 2007 to present if (in_array($year_url_segment, $years_on_database) ) { //find pages in that year } Off course I'm considering the url with just one year, not a period.
×
×
  • Create New...