-
Posts
4,320 -
Joined
-
Last visited
-
Days Won
80
Everything posted by diogo
-
You will still see the page if you are logged in as super user. Logout or access that url in the browser's private mode to check if it's visible to general public. For maintenance, besides Pete's module check also these tips of mine http://processwire.com/talk/topic/3324-maintenance-mode-message/?p=32769 http://processwire.com/talk/topic/2475-quick-tip-for-testing-on-live-website/
-
De Nada
-
If you have few variations of sort you could do it with a switch statement: switch ($get) { case "name DESC": $sort = -name; break; case "name ASC": $sort = -name; break; // and so on... } If there are more variations you can automate it like this: $sort = explode(" ", $get); $order = $sort[1] == "DESC" ? "-" : "" ; $value = $sort[0]; $pages->find("template=basic-page, limit=10, sort=$order$value");
-
I don't have a clue about the answer, but you can post this here for sure. That's what the dev talk forum is here for!
-
Sorry that you got no answer. I'm glad that you managed to solve it by yourself. Is this a multiple image field? Because I would expect it to be single. Anyway, for multiple images fields this has been recommended: if ($this->user->avatar->count() > 0) { But I think it would be better just to give limit 1 in the avatar field settings. -- What does this do? Is it only checking if the segment is a valid name? Didn't you mean to check it against the user name or something like that? $this->sanitizer->name($this->input->urlSegment2) == $user->name
-
What's a good way to remove script tags in body through the API?
diogo replied to MarcC's topic in General Support
Find a regexp that matches comments and script tags and remove them with preg_replace() from all the bodytext fields. If you already imported everything to PW, you could do something like: foreach($mypages as $p){ $p->of(true); $p->body = preg_replace($pattern_for_script_tags,'', $p->body); $p->body = preg_replace($pattern_for_html_comments,'', $p->body); $p->save() } -
Some time ago I posted the solution that I came up for a site http://processwire.com/talk/topic/659-newsletter-system-with-pw/
-
The system is using jquery ui. You can use the theme roller to create your own theme, and then apply it to the messages on your site, just like Ryan did with the admin.
-
It should accept any php valid format for dates.
-
Just to say that ChromePHP is now called Chrome Logger and lives on this url http://www.chromelogger.com
-
I don' think it's a good idea to make your site depend of something like this. If something changes with an upgraade, it will break everything.
-
Google images uses something very similar.
-
Here is the documentation for that http://dev.mysql.com/doc/refman/5.7/en/fulltext-fine-tuning.html. But this is not something simple or even advisable to do...
-
Your code looks ok to switch the language o the same page. Just make sure your language names conform to the php language codes. If you want to redirect to the language urls, you can do this: $session->redirect($page->url . substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2)); edit: of course you have to have a default, because your website won't have a page for each language in the world.
-
This one is my favourite http://martywalker.com.au/blue-mountains/katoomba/old-coles/
-
Hi Rick, head.inc and foot.inc don't represent literally the html <head> or <footer>, they are just there to hold code that is common to most pages. That's why you find navigation and summaries there. They could be called top.inc and bottom.inc or start.inc and end.inc, but those names are generally recognized among developers, so it makes sense to use them on the default install. You are the one choosing the level of editability (my spellchecker doesn't like this word) of the sites you design. Some times it makes sense that everything is editable, and processwire for sure allows you to do this, other times you want a bigger control over some aspects of the website, and make it available for the editors to change only what's necessary. In the latter case it makes sense to have some content hard coded. You should do it, we all are. The default install serves only as an example. Ryan created the most simple site that still has some complex snippets of code, here and there, that you can take as example, with few templates and fields, but that represent a lot of you can do with pw. Do as you wish—use some code and some of the fields and templates, or just wipe it all and start from a blank state. But make sure you learn from it because it's full of nice details
-
Looks great! I really like what your doing visually, but also that you are offering help to improve the admin in general.
-
This puzzle doesn't have fixed pieces, so there is no limit for what you can do with it. I also this the way Ryan organized things is easier for beginners, but some people are doing precisely the opposite. Something like this: // all pages have same template file main.php (but different admin templates) // main.php holds both the header and the footer // here goes the header... <!doctype html> ... <body id="<?= $page->name ?>"> // here we call a .inc file with the name of the admin template <? include($page->template . ".inc") ?> // and here goes the footer </body>
-
For this site I took the approach on the fixed menu because it's so simple, but the cms has still an important role on this site. All the videos and authors are being saved as pw pages, and that's where the owner of the site can get all the information. Also, all the content of the pages is editable, so, the menu is the only thing that is not taking advantage of the cms capabilities. Well, that's the problem of doing things in emergency... but to be fair, this won't take a long time for me to correct, so I should just do it. There you have it, done! took one minute with this code <html lang="<?php echo $page->english ? "en" : "pt" ?>"> edit: Thanks for the compliment on the site, você está sendo muito legal
-
Creating A Javascript/JQuery Accordion for Repeating Fields
diogo replied to rosieate's topic in General Support
Hi rosieate, welcome to the forum! Try this with jQuery: $('.bio h2').siblings().hide(); $('.bio h2').click(function(){ $(this).siblings().toggle(); }); I wrote this quicky in the browser, but should work. You can also make them slide down and up by using slideToggle() instead of toggle() -- Just a note: You are using <section> for an element that has a repetition. In html5 you should use <article> instead for such cases.- 3 replies
-
- javascript
- repeaters
-
(and 2 more)
Tagged with:
-
Welcome to the forum jwaldeck. You're right that the multilanguage methods documentation are a bit dispersed on the forum (ok, a lot). It's a great idea to write this document. Right now i can't help you with this, but I can describe very simply, what i did in a site that wasn't built for multilanguage, and I had to add it very quickly http://museudoresgate.org/. Because the site is really small and I was in a rush, I just added a new page in english for each one of those that wanted to be translated. They were right there in the tree, next to the others, because I didn't wanted to change the structure that I had. I also didn't want "pt" and "en" in the url. I created a checkbox "english" with the label "english page?" and made it global. I also created a page field for the portuguese pages with the label "corresponding page in english" only with pages with that checkbox checked (all english pages), and also made it "single page" and global. The menus were build manually, so, I just had to check if($page->english) and render the correct items for each language. To link to the corresponding page in the other language I used the page field like this: <a href='<?php echo $pages->get("corresponding_page=$page")->url ?>'>PT</a> and <a href='<?php echo $page->corresponding_page->url ?>'>EN</a> That's it! I only had to make sure that each english page is using the same template as the same portuguese page and fill it with the translations. Only thing that took more time were the hardcoded things that I had in javascript (don't tell anyone...)
-
Thanks for finding those WinnieB. I corrected them already.
- 4 replies
-
- 1
-
-
- soundcloud
- embed
-
(and 1 more)
Tagged with:
-
How do I remove certain field/data after given date-time?
diogo replied to Vineet Sawant's topic in Getting Started
I think you should do this control in the templates. You can have a page for each drama, and children pages or a repeater for all the shows of that drama. On them you will have a date field with the time of the show. Then on the template you can do this: if (($page->date - time()) < (3 * 60 * 60)) { // 3 hours in unix time // tickets can't be sold anymore } and if (($page->date - time()) > (7 * 24 * 60 * 60)) { // one week in unix time // tickets are available from now on } -
Nice tool for testing websites and apps on several android formats https://www.manymo.com/
-
- 1
-
-
Replacing default language or just using the Pages Name module?
diogo replied to landitus's topic in Multi-Language Support
Yep, with Soma's solution , maybe the mot practical would be to do one template at a time. You could go to that template and check what are the fields that you want to change. And then do it for all the pages of that template: $pa = $pages->find('template=basic-page'); Then, repeat for another template. Edit: I hope this will help you to get rid of that spanish, and replace it for the so much nicer portuguese