-
Posts
10,902 -
Joined
-
Last visited
-
Days Won
349
Everything posted by adrian
-
If you want to make it a little cleaner, you can do: $articles = $pages->find("template=articles, parent.status<".Page::statusUnpublished); Now you know when looking back on your code, what status you are looking for. Also, I changed the operator from != to < because the numbers that drive these status values are bitwise and are added to together. This way you could also have hidden applied to the category and it would work as expected, but if you use the != you'll get the articles returned again, because the status value will be the addition of unpublished and hidden. Here are the values: https://github.com/ryancramerdesign/ProcessWire/blob/6cba9c7c34069325ee8bfc87e34e7f1b5005a18e/wire/core/Page.php#L76 Note that 2049 is the addition of statusOn and statusUnpublished. Throw statusHidden in there as well and you end up with 3073.
-
Hi Jennifer, I don't think anything exists right now, although I have a vague recollection of something along these lines being mentioned somewhere - maybe not? Anyway, I think this could be a useful module. It could be a log file like typical apache etc log files, but then you'd need a way of analyzing them, and also archiving old ones etc. Maybe a custom database table would be a better approach. I think to get the most of it, we'd probably want to build a dashboard in the PW admin that would allow you to visualize the search terms - maybe something as simple as using a tag cloud generation algorithm (I have used this code in the past: http://chir.ag/projects/tagline/), or maybe something more sophisticated/customizable. I'd actually be interested in tackling this module - it shouldn't be very difficult, but I probably won't have the time for a little while at least, but I can definitely see it as a useful addition to a big long term project I have on the go right now.
-
Quiet mode will help you with the created part: https://processwire.com/talk/topic/5109-page-save-silently/?p=49275 but to set the modified you'll still need to use SQL because as soon as you save the page, modified gets updated again. At least that is my experience. Maybe there is another workaround I haven't thought of. https://processwire.com/talk/topic/651-set-created-by-creating-a-page-via-api/?p=5293
-
Possible to register and login simultaneously
adrian replied to onjegolders's topic in General Support
And just because I am procrastinating, if the role doesn't already exit: $newrole = new Role(); $newrole->name= 'frontend-editor'; $newrole->addPermission('guest'); $newrole->addPermission('editor'); //or whatever permissions you need it to have $newrole->save(); $u->addRole('frontend-editor'); $u->save(); -
This is untested in the context of repeaters, but if you add this to your selector, it should exclude pages in the trash: has_parent!=7
-
A minor optimization: $page->save("links"); Not sure the real world advantage to this, but this means that you are only saving the links field and not all the other fields on the page.
-
Hi dees2012 and welcome to PW. Here is a comprehensive writeup from Ryan: https://processwire.com/talk/topic/27-moving-pw-between-staging-and-live-server/?p=63 There are lots of other posts about this: http://bit.ly/1i9iJ3r Hope that helps. Let us know if you have any specific questions.
-
Hey Marty, I don't actually like the dual pane functionality in XtraFinder, which I why I use Forklift. XtraFinder is really just on my list as a free alternative to deal with Mac's stupid (IMHO) folder/file ordering. I actually think I would literally go insane without Forklift. But if you do want the quasi dual pane thingy in XtraFinder, you have to click on the new face icon in your menu bar and choose vertical or horizontal from there.
-
Here's a few things to play with - I am a relatively new Mac guy too and the first few keep me sane http://binarynights.com/forklift/ and/or http://www.trankynam.com/xtrafinder/ if you can't stand folders mixed in with files alphabetically) http://hyperdock.bahoom.de/ http://stclairsoft.com/DefaultFolderX/ http://www.alfredapp.com/ http://justgetflux.com/ http://jumpcut.sourceforge.net/ (might be a newer alternative, but I use this all day long) http://www.mirovideoconverter.com/ (not Mac specific, but so convenient and easy) http://www.boastr.net/ http://www.vienna-rss.org/
-
I guess it doesn't like the #t=134 Too bad you can't pass the start time though. I tried some of the other formats: &t=1m34s etc, but these must get stripped by the forum because they don't work.
-
I know I had some confusion with checkboxes in PW and I think I tried several things to get them working as expected. I think since then I have been blindly copying existing code. Point noted though and just to confirm. This actually works just fine $f = $this->modules->get('InputfieldCheckbox'); $f->attr('name', 'input_country'); $f->label = 'Country Code'; $f->attr('checked', $this->input_country ? 'checked' : '' ); $f->description = 'Whether to ask for country code when entering phone numbers.'; $inputfields->append($f); No need to set the value at all - just like you said
-
Martijn, This is working for me: public function ___getConfigInputfields() { $inputfields = parent::___getConfigInputfields(); $f = $this->modules->get('InputfieldCheckbox'); $f->attr('name', 'input_country'); $f->label = 'Country Code'; $f->attr('value', $this->input_country ? $this->input_country : 0 ); $f->attr('checked', $this->input_country === 1 ? 'checked' : '' ); $f->description = 'Whether to ask for country code when entering phone numbers.'; $inputfields->append($f); Maybe you can see something in there that's different to what you are doing? Sorry, I can't think of anything else to try!
-
That was my initial thought, because for checkbox checking I have been using == "1", but I tested with === 1 and that works fine for me too. In this case $this->fname is not coming directly from the POST, so it shouldn't matter, no?
-
Martijn, That does sound weird. The one thing in your code that looks off to me is this: $field->attr('value', 1); Won't that override the value every time the form is built? I have always done this: $field->attr('value', $this->fname ? $this->fname : 0 );
-
Right after install script: "Database unavailable."
adrian replied to johnstephens's topic in Getting Started
Hi @johnstephens and welcome to PW. Sorry your first experience has been less than stellar. That error seems a little strange given everything else you have described, but if you can access the homepage, then obviously PW is being able to connect to the database to get that content. Typically if you can access the homepage, but no other pages, including the admin it is a mod rewrite issue. Have you tried uncommenting the first of the RewriteBase options in the .htaccess file - around line#103? -
Call to a member function first() on a non-object
adrian replied to bwakad's topic in API & Templates
In the docs for this module it says: In the location where you want to output your map, place the following in your template file: $map = $modules->get('MarkupGoogleMap'); echo $map->render($page, 'map'); You are using $Location there which is a string "$Lat, $Lon" based on your definition of it. It needs to be a page object. When you are getting errors like this, it is sometime best to start with the default code from the docs before experimenting with other approaches, like parsing xml. Stick with the basics. Once you have those grasped, the rest will be easier to sort out and we'll continue to help/ -
Currently this isn't possible by default, but I like the idea of not having to populate address fields in two places. I have taken the other approach and parsed the address from the map's address field into the components I want for displaying on the site, but this has problems depending on how the address was entered if it's not consistent. Thinking quickly, you could hook into page save and grab the contents of those address fields and use them to populate the map's address field. The problem is that the geocoding happens on blur of the address field, so that would need to be triggered in some other way in your module. Something to think about anyway.
-
I agree with Joss - separate fields sound like a much better solution!
-
I think it is likely this line: $audiofiles = $audio->audio->filename; Try it with just: $audiofiles = $audio->audio; You need to keep that audio field as an array, rather than getting its filename at that point.
-
Looks pretty cool diogo. One small thing - in the recursive call of the function, you are using findPages, instead of myFindPages
-
Retrieve The Type of A Field From Inside A Module
adrian replied to bytesource's topic in Module/Plugin Development
All you need is: if($fields->get("fieldUsingTextile")->type == "FieldtypeText"){ I haven't played with textile, but I am curious why a plain text field would have paragraph tags in the first place. Are they coming from textile, or are they being pasted in and not stripped, as they would be in a normal plain text field? -
To be honest, and no offense intended to the author of that module, but I don't believe it is really stable yet and unfortunately he hasn't been responsive to fixing some of the issues. The other issue is that it includes a lot of fields that you may not use. I think you'd be much better off creating your own system for front-end user management - it is very easy. This post from Ryan should get you started: https://processwire.com/talk/topic/1716-integrating-a-member-visitor-login-form/?p=15919
- 30 replies
-
- 2
-
- Drupal
- get started
-
(and 1 more)
Tagged with:
-
The API handles all the CRUD operations. eg, to create a new page: $np = new Page(); $np->parent = $pages->get("/about/"); $np->template = "basic-page"; $np->title = "New Page"; $np->of(false); $np->save(); Take a look at the API cheatsheet: http://cheatsheet.processwire.com/
- 30 replies
-
- 3
-
- Drupal
- get started
-
(and 1 more)
Tagged with:
-
I obviously need to read up on ElasticSearch some more, but this sounds pretty cool - thanks!
-
You can pass variable via render like: echo $pages->get($child->id)->render(array('mobile' => $mobile)); and then in the template use $options['mobile'] to get the value.