Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 01/17/2021 in all areas

  1. The json_decode() function has an "associative" argument that you can set to true: $meevo_response_array = json_decode($meevo_response, true); Or you can use the core wireDecodeJSON() function which does this automatically. $meevo_response_array = wireDecodeJSON($meevo_response);
    3 points
  2. The title field is already optional. You just need to make it non-global by editing the Title field and unchecking the Global checkbox on the Advanced tab. Then you can remove it from any templates where you don't need it. If you want to see the values of other fields (instead of Title) in Page List you can set that on the Advanced tab when editing the template.
    3 points
  3. I've added 1.5 million pages. It works faster than Wordpress, but server response time is still high - 0,8-2 s. I have 4 Cores, 4 GB RAM and SSD disk, Mysql 8 and PHP 7 I'll keep you updated
    2 points
  4. Hi, not sure i understand the question that well... but i'll try ? if what you want is to display the content of, say job 1 applications contents, its quite simple, you can use the $page->chidren() method to retreive all the children of the page you're on if the page you use to display job application is not the job page itself, just start with a method to get the job page example... you have a single page that will show all the applications for a job depending on a link from the job page itself on the job page (let's say job 1) make a link with something like job-applications/1017 on the job-application template, allow url segments and now, sure you've guessed, you can retrieve the job page children using that segment (you could use the page name instead of its id, prettier even if a little - very little - more code to retreive the page id using name and template but this is just for the example) $jobpage = pages->get(1017) $applications = $jobpage->chidren(); job done ? hope it helps have a nice day
    2 points
  5. Hi Robin, and thanks a lot for your answer you're right, Page References is a great way to implement tags/categories, that's what i use a lot for blogs/news for example actually, Page References are not really multilingual by themselves but, as you retreive a page... reference ? thanks to pw API, it's so easy to get their local title and name plus whatever field the pages may contain and funny enough, i've been hesitating between those custom fields for images and... your image repeater ? for quite a big gallery coming from the author himself i'll follow your piece of advice and use the custom field solution even it's just for two fields actually, a legend and a category/tag actually, the Page Reference field does part of the job for me, i have both the categories titles to display on the front side and the css value using the pages names without having to sanitize the title when multiword and/or containing diacritics what i have to do when dealing with native image tags in a monolingual website... (in french, you may have guessed with my english :)) have a nice day
    2 points
  6. Shetland.org is a website run by Promote Shetland which inspires people to visit Shetland, encourages people to move to Shetland to live, work and study, and attracts people to invest in commercial activities in the isles. We (NB Communication) have run the Promote Shetland service on behalf of the Shetland Islands Council since 2017, and as part of the contract undertook a project to redevelop the existing Shetland.org website. In this showcase we’ll highlight a selection of modules we used and what they helped us achieve. Visit the site: www.shetland.org Pro Modules ProCache We use this on almost every site we build. Indispensable. The cache settings used are pretty simple – most templates are set to 1 week, with the entire cache being cleared on save. We use ProCache’s CDN functionality to serve assets from CloudFront via c.shetland.org. We also use the API provided by ProCache to compile (SCSS), minify and collate our styles and scripts via $procache->css() and $procache->js(). We then use the URLs returned to preload the assets, making the site even faster! ProFields: Repeater Matrix Again, we use this on almost every site we build. Another must have Pro module. This module allows us to create a really powerful page builder field (we call it ‘blocks’) that handles the majority of the content on the site. On a simple development, we just use two block types - Content and Images - the latter displaying as a gallery or a slideshow. On this site we have 13 different types, including ‘Quotes’, ‘Video’, ‘Accordion’, and ‘Links’. Additionally many of these are configurable in different ways, and some render in different ways depending on the template and context. Have a look at the links below for some examples: https://www.shetland.org/visit/do/outdoors/walk https://www.shetland.org/blog/how-shetland-inspires-me-artist-ruth-brownlee https://www.shetland.org/life/why/teach-shetland-school NB Modules We also used a number of modules we've authored: Instagram Basic Display API Used to retrieve the 6 latest images from instagram.com/promoteshetland. Markup Content Security Policy Used to implement a CSP for the site. Currently scoring a C on observatory.mozilla.org – not the best score possible but significantly better than all the other destination marketing websites I tested (all got an F but one which was a D-). Pageimage Srcset Used throughout to generate and serve images of different sizes via the srcset and sizes attributes. This module is really useful if you are looking to optimise the serving of images to improve page speed times/scores. Video markup for YouTube/Vimeo This module was developed specifically for use on this website, as we wanted more control over the rendering of the oEmbed data. In the example below, the video thumbnail is displayed with a text overlay – when clicked the video (YouTube embed) opens in a lightbox. And a big shout out to… Page Path History The previous site was also built by us in ProcessWire, but a number of years ago now. The new site has significant changes to the sitemap, but 1000+ blog posts were also migrated. Instead of an .htaccess file with thousands of 301 redirects, we were able to use the functionality provided by this module to implement redirects where required, and in the case of the blog posts which were migrated via an import script, implement the redirects via the API - $page->addUrl(). ... The above is just a fragment of the features present on this site, and the development just a part of a much larger project itself. We're really proud of what we've achieved, and we couldn't have done it without ProcessWire. Cheers, Chris (NB Communication)
    1 point
  7. At least this part can be done with a simple hook ? // site/ready.php $wire->addHookAfter("Pages::saved(template=foo)", function($event) { $page = $event->arguments(0); $page->name = $page->id; });
    1 point
  8. @SwimToWin - did you make the template settings changes described in the post that @bernhard linked to?
    1 point
  9. That's exactly how things already work ? At least the first part of your message. https://processwire.com/blog/posts/processwire-2.5-changelog/#adding-pages
    1 point
  10. hi again ? ok, now, i understand a little more the problem which is to have a single page displaying different contents depending on the form submission and, i can see two or three different easy ways to deal with this 1 - if the content if complex, not a simple content of a few fileds, you may have a cached page the chidren of which are the different contents you will display on the result page and, of course the way you choose what page content to display depends on what you prefer, it could be having an array/object storing something like result/page id or a field in each of those pages to store what result it matches 2 - if the content is not that big or complex, you could also have a repeater in the result page and code which one is to display depending on the form result the third one is one of my bad habits ? storing the results in a personal db table with a custom admin module/page to edit them and retrieving the result, once again, depending on the form result but, honestly, the more i work with pw, the more i tend to use its abilities to deal with different contents and data structure, i am in a slow personal table rehab process ? Have a nice day
    1 point
  11. Hi, i'm not sure i understand the question that well but let me try the problem seems to be, you would like to have the localisation for each language in the url, for example as you said, xxx.com/contact xxx.com/fr/contact and this for all you pages if so, the solution is really simple provide you have installed the FieldtypeURLLanguage like Robin an kogondo said by default, the home page is the "mother" of all the other pages and, by default, the home page has no name in pw but has the name field usable then - leave it blank in the default language - in the other language(s) use whatever you want to set it's url (quite often the iso code will be the simplest) this way the home page url wil be - xxx.com in the default language - xxx.com/fr/ in french and so on for all the languages you use and the pages urls will be - xxx.com/the-page/ in the default language - xxx.com/fr/la-page in french for example this works if you have the same name in both languages too, xxx.com/contact => xxx.com/fr/contact hope this is what you were looking for ? have a nice daay
    1 point
  12. Hi, sorry to come to you so late... actually, i your case i would choose a very simple solution which would be to use pw ability to fill all the languages with the default one if they are empty having worked on a website in nine languages (including russian, chinese and japanese), you can imagine that the case you describe happened quite a lot... my solution in your case would be quite simple, if the editor only has the news in the non default language, well, let them fill the... default language, pw will take care of the rest of the job then, the question will be, do you want to display all the news in both (or more) languages, no matter the language they appear in - if so, job done - if not, just add a select on the news template to choose in which language(s) it will be displayed with both/language1/language2 (for more than two languages, a multi select or checkboxes would do the job) this being done, it's easy to exclude news on the allnews template depending on their language and not to display the language switch on those that are not translated or, if more than two languages, only display in the switch the languages you want in case it helps have a nice day
    1 point
  13. Sorry, I'm not sure then - it's working here. I think perhaps you need to do some debugging at your end to make sure the unlink call is actually being made and also clarify that $file->filename contains the full path to the csv file. Also, try: $this->wire('files')->unlink('/fullpath/site/assets/files/1443/file.csv'); in the Tracy console just to test this in isolation. If that doesn't work, try a regular php unlink and if that doesn't work, check to make sure there aren't any file permission issues.
    1 point
  14. @dotnetic, thanks for the clarification, but I must admit that I still see this mostly as a bad thing. I believe this would work best if issues were actively discussed by both users and maintainers, and/or maintainers were so busy that they were forced to focus only on those issues that attract a considerable number of new reports from users on a steady basis. In our case that's, in my opinion, not the case: an issue or feature request can be valid even if it hasn't received comments, or been acted on by Ryan, in months -- if not years. Anyway, that's just my take on this. It's not a bad idea per se, I just don't see a lot of value in it in our specific context ?
    1 point
  15. I think you're better off not using FieldtypeCache. See this issue for some discussion: https://github.com/ryancramerdesign/ProcessWire/issues/1577 And I remember Ryan commenting somewhere that he's thinking of removing it from the core. The simplest thing if you want to merge multiple fields into a single field for search purposes is to use the SearchEngine module. Or if you want to go more hands-on it's not difficult to populate a hidden "index" textarea field from other field values using a Pages::saveReady hook. $pages->addHookAfter('saveReady', function(HookEvent $event) { $page = $event->arguments(0); if($page->template == 'your_template') { $index = $page->title; if($page->body) $index .= ' ' . strip_tags($page->body); foreach($page->tags as $tag) $index .= ' ' . $tag->title; $page->index = $index; } });
    1 point
  16. I don't know much about multilingual websites, but I think Page Reference fields are multilingual. And Page Reference fields are the most powerful way to implement tags anywhere in PW. Now that have the custom fields for Files/Images feature it seems like this would be a good solution.
    1 point
  17. Interesting approach. It deserves further investigation, I think. If I understand it correctly, you propose another set of children – separated from the current set – which is used for layout only perhaps? Reading other's comments, I think most of us do not ask for a "Gutemberg only like" feature, instead, most of us need a way to implement a builder which is similar to the current repeater(matrix) based solutions others have presented in the forum, but geared towards layout + building. Editor.js could simply be another fieldtype, just an alternative to CKEditor. You and/or your client could decide which one to build upon your "RTE editing needs".
    1 point
  18. Another, somewhat similar story: https://medium.com/vimeo-engineering-blog/its-not-legacy-code-it-s-php-1f0ee0462580
    1 point
  19. Hi, @MadeMyDay as a former modx evo user for quite a long time and now completely pwired i of course really like this "why i choose..." article of yours ? just one thing to add, maybe you may set your website config debug on false, it currently displays errors to the bottom of the article ? Have a nice day
    1 point
  20. Hey all, I guess I will just write here instead of starting a new topic. Did anybody manage to implement something like that? More specifically I would need title and name field to be pre-populated when creating a new page ($page->title = $page->parent->title & $page->name = "temp_".$page->title). I was planning to do it via hook in module, but I have no idea which hook would do something like that. Page name would than be renamed based on some field value (which I guess is simply done using "before save" hook). Thank you all for your help! EDIT: OK, it was actually really simple solution. I solved it by using "one-step page add" solution from above, then I used a "saveReady" hook to rename page title and page name. The only problem that remains now is how to check if user changed the title after. In other words: how to check if the title that is present now (before the page save) is the same as the one in the database. $page->field outputs the one from db and I don't know how to access the one from the form that was just typed in. I tried with $input, but it doesn't output anything. Any ideas? EDIT 2: So the answer to my last question (if somebody will need it) is: When attaching something to saveReady hook, one can access form values (on a new page dialog) via: $event->arguments('page')->data['field'] For example to get to title: $event->arguments('page')->data['title']
    1 point
×
×
  • Create New...