-
Posts
2,241 -
Joined
-
Last visited
-
Days Won
47
Everything posted by netcarver
-
If any of the users who get to enter stuff into these fields are students then I'd say "Yes!" Make sure every field they can type into is encoded. Similarly, if input is coming from staff or contractors, any of whom may get disgruntled or leave with a grudge, then leave it on.
-
Yes, Debugging Templates and Core Code Works!
netcarver replied to Gazley's topic in Getting Started
Just found this thread and it set me off exploring to see what debugging features were possible in Vim. I've not used a proper debug environment/IDE with PHP though I used to with assembly/C/C++. I found an excellent plugin (joonty/vdebug) that, coupled with XDebug, works amazingly well and allows you to single-step, watch variables (global and local scopes), set breakpoints on lines/conditions and do evaluations - in short, all the usual suspects. I've been using it to single step through PW as it builds pages - neat! -
Html fields, tokens, per-page assets questions
netcarver replied to ferahl's topic in Getting Started
There's also a textformatter for the Textile lightweight markup system if you'd prefer- 5 replies
-
- 2
-
-
- html fields
- tokens
-
(and 1 more)
Tagged with:
-
Setup > fields > title > advanced tab > turn off global flag > save > remove from templates where you don't need it. I think that should fix it -- but don't know if that's the official way to do it.
-
I'm trying this out now as it's a new Inputfield type to me. Can you point me in the direction of a module that uses this Inputfield type so I can get a look at how it's used? I tried the following but I'm missing something... $field = $m->get("InputfieldPageAutocomplete") ->set('label', 'Select individuals you wish to notify') ->attr('id+name', 'users') ->set('parent_id', $this->config->usersPageID ) ->set('labelFieldName', 'name') ->set('columnWidth', 50) ->attr('value', explode("|", $user_ids) ); ; $form->add($field); Thank you in advance!
-
Which file permissions are needed for upload?
netcarver replied to Nico Knoll's topic in General Support
For the record, I'm on a linux installation using FF 16 but I've seen this problem as far back as 14. PW is 2.2.9 and disabling all the extensions in FF doesn't solve it. I'm now wondering which firefox config setting I've mucked up that might stop JS in FF receiving dropped files as Linux is clearly capable of handing off such information to Chromium. -
Which file permissions are needed for upload?
netcarver replied to Nico Knoll's topic in General Support
Did a little digging and in my case the set of files the JS in InputfieldFile.js is receiving into the drop handler is empty so traversing the set just drops through as files.length is 0. I wonder if one of my FF extensions is preventing this from working -
Which file permissions are needed for upload?
netcarver replied to Nico Knoll's topic in General Support
Nico, are you sure this isn't a browser issue? I have a problem with drag-n-drop uploads to my test server if I use FF but it's fine in Chromium. -
Warning: Still a work-in-progress. Still has quite a lot to be done. At Tom Reno's request I started work on a module that allows you to setup various watches on fields in your PW installation. You get to choose a field and can then specify when a change to the watched field should trigger a notification email to various interested parties. Pictures might help, so here we go... I intend adding a further restriction so fields in certain templates can be watched.
-
Hi SiNNuT, yes that's true, I was assuming the field is only used in one template.
- 10 replies
-
Hello again Brian, Doesn't really fit with the point so if you did go down the route of iterating over the results yourself, you'd probably have to take nibbles at it as Nik is suggesting. However, given your extra information I'd try calling the DB directly. Just querying the table representing that one field should be all you need. If the field were named, say, "design" then this might work for you... // Pull designs from DB grouped by design... $result = wire()->db->query("SELECT *, COUNT(`data`) AS `num` FROM `field_design` GROUP BY `data` ORDER BY `num` DESC"); // Following loop should be fine for the server with ~60 iterations. If not, you might try caching the generated output. while($r = $result->fetch_assoc()) { $num = $r['num']; $d = $r['data']; echo "$num pages using design $d\n"; // This is plaintext output, use HTML if needed // If you wanted to pull a feature from the page SQL chooses to group them on you could do it something like this... $page_name = wire()->pages->get($r['pages_id'])->name; } Again, totally untested. YMMV.
- 10 replies
-
Hi Brian, I can't give an authoritative answer on an equivalent to GROUP_BY in the API but can I ask In what ways these pages are 'similar'? It looks like it might be by template based on the code you posted but is there some other similarity you want to use in the grouping? If it is by template and you either have a limited number of templates or a fairly limited total page count then you could iterate over the result of the find() call. Something like this... $groups = array(); foreach( $pages->find("template=templateA|templateB|templateC") as $p ) ) { $groups[$p->template->name][] = $p; } if(!empty($groups)) { foreach($groups as $template => $group) { $count = count($group); echo "Pages using $template: $count\n"; // This is plaintext output, add HTML if needed } } Caveat: totally untested. YMMV.
- 10 replies
-
Err, I think it was Antti (apeisa) and not Soma that posted that
-
Added two new transformations to the module: 'email' and 'html'
-
Hmmm. Does this work?.. if($page->template == "home") { if($session->noPop){ // No popup }else{ // Go popup... // But don't do it next time... $session->noPop = true; } }
-
I've pushed some changes to the development branches of the TagParser and the ParserTester that add debug information and "global" transformations. The debug option can really help show what's going on behind the scenes. You'll need to grab both of the modules to use the new features.
-
Textformatter to convert www.domain.com to hyperlinks
netcarver replied to apeisa's topic in Modules/Plugins
I like Ryan's idea. I have a dislike of situations where the same address is repeatedly auto-linked, far better to let the author decide which of the links in their writing should be linked and Ryan's suggestion would take care of that. Could your module be given an option to also hide the scheme from the linked text? So "http://processwire.com" would become <a href="http://processwire.com">processwire.com</a> -
Hmmm, probably not. However, here is an untested idea you could try if the only thing you want at your site root is the link shortener: set the template of the home page to LinkShortenerHome and use that as the bin for shortlinks.
-
If teppo's suggestion doesn't work & you do go down the route of writing some code to solve this & if you need to do more than one substitution then take a look at the TextformatterTagParser as that was written to help in such situations (but I think it would be overkill in this case.)
-
lucas, it looks like you didn't login after the initial install and there's something wrong with your DB credentials. Look near the end of the file site/config.php and make sure the $config->dbHost line really does point to the location of the MySQL server. Whilst using something like "localhost" works ok on some web hosts, I know it doesn't on mine and I have to make sure that this is the name of the correct db server.
- 1 reply
-
- 1
-
-
Once installed, you'll see a new "Short Links" page under your site root. This is a bin for storing shortlinks - which are simply child pages. If you edit the "Short Links" page you'll see various parameters that control the automatic generation of link names. You should be able to leave these as-is with no problems (unless you need more than 27,000,000,000+ links in your bin!) The parameters, if curious, are... You can add as many bins for shortlinks as you like to your site, just create a new page using the template "LinkShortenerHome" and give it a relatively short page name. Anyway, let's add a short link now. From the page tree just click new next to the "Short Links" page. This creates a new shortlink page (uses the "LinkShortener" template) and automatically creates an unused, random, page name using the parameters we just looked at from the parent bin. Something like this... If you are not happy with the spelling of the generated shortlink (if it happens to be offensive in your native language for example) then you can change it now and hit the save button which takes us to... ..where we just type/paste in the target for the redirect this shortlink will make and then hit the publish button... ... and we can see the short link and a "Go!" link for testing it. That's about all there is to it except to say that it will help out the ProcessRedirects module if it is installed and you have configured the URL Shortener to help generate names for it. HTH.
-
Nico, any plans to add this to the modules directory -- or have I just missed it in there totally?
-
I've not tested this code but it's a first guess at how I might try this. It assumes $email and $pass hold sanitized input from a custom login form. $who = wire()->users->get("email=$email")->name; if($who) $user = wire()->session->login($who, $pass); if($user) { // they authenticated ok... } else { // they didn't }
-
Version 1.1.1 now available. Just fixed a bug that occurred if multi-byte support was not installed on your host. (Thanks to renobird for finding that.)
-
Forgot to mention: you can do a PW style 'or' in the field part of the tag. Like this... Look at the "{title|name|id}" page to... Or this... Hello {user.firstname|name>title}, ...