Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 02/20/2014 in all areas

  1. You need a fieldtype, if you have content, that is specific to a page. Field belongs to a template, and page has a template - so the content in fields is always tied into pages. Since 404 pages aren't actual pages, having field doesn't have much sense. What you need is database (or flat file or anything really) where you just store those results. Then autoload module is your way to find those 404 hits and save that data. Then if you want to provide admin ui for that data, then you would build process-module.
    5 points
  2. I haven't read your code of the project. Just want point out that: If you have to call PHP scripts directly (not include them), with it's URL, you cannot store them into the sites/... folder. If it is only one script, you may place it into the root besides the index.php of pw. Also if you want / have to collect some output from that script within pw, you can bootstrap PW within that script, store a result into a $session->var and also use $session->redirect according to that output, if you need that.
    4 points
  3. You may do this by a module like that: public function init() { $this->addHookAfter('ProcessPageListRender::getPageLabel', $this, 'addPageListLabelItems'); } public function addPageListLabelItems($event) { $page = $event->arguments('page'); // then you do your conditionals and your styling, like for example: if($page->myField >= $myMinValue && $page->myField <= $myMaxValue) { // add your styling here } // or like that: if('architekt'==$page->template) { // add the styling here $styleItem = $page->ortarchitekt == '' ? ' <span class="jhpPageListItemEmpty"><strong style="color:white">kein Ort eingetragen</strong></span> ' : ''; // now add the new style item to the existing output $event->return = $event->return . $styleItem; } } This way I get outputs like that: EDIT: Ah, have found it: here is a module from Soma: http://modules.processwire.com/modules/page-list-image-label/ that adds a Thumbnail to the list. That was the startingpoint for my customized PagetreeList. If you are not (yet) familiar with modules please have a look to the HelloWorld-Module or ask here for further assistance
    4 points
  4. Please add your ProcessWire sites to our directory, immediately before or after posting to this board. We want to make sure that everything posted here is also posted in our official directory.
    3 points
  5. Just stumbled upon this: http://typequest.org/ Type in web is maturing! --- ps: I will watch Porto playing against the club from my second city now
    3 points
  6. That's what I am still struggling with. Having worked before with a lot of other cms'es and wysiwygets and then all of a sudden all the rules and walls fall away. You have to step over old thinking, habits and routines. There's also self coding and php that gets in what you need to learn.
    3 points
  7. Exactly my own thoughts when I first discovered PW. 'It can't be that easy.' (I came from a mostly Mambo/Joomla & Wordpress background and found it unbelievable that a CMS existed that didn't enforce rigid field & template structures on the user.)
    3 points
  8. Hi guys, this one comes a bit late since it was published already some time ago. It's the website for a charity in Sollihul. http://www.madhatterscharity.com/ We wanted to do something fun and appealing to both children and adults, and came up with the idea of simulating handwritten type and pen drawings (created by us) on a rough cardboard, and using different colours for each page. The site is responsive, of course More about this work on our website http://www.milktop.co.uk/projects/mad-hatters-tea-party-charity/ And a short post about the drawings http://www.milktop.co.uk/news/mad-hatters-tea-party-the-making-of/
    2 points
  9. Don't understand the question exactly, but here are some nice docs: http://processwire.com/api/fieldtypes/repeaters/ Also repeater pages have a special template called "repeater_yourField". So theoretically you could also get repeater pages the following way: // Get last item sorted by created DESC $item = $pages->find("template=repeater_yourField,sort=-created,limit=1"); // Get first item sorted by created with an additional condition $item = $pages->find("template=repeater_yourField,sort=created,field|field2%=blub,limit=1");
    2 points
  10. David, Welcome to PW and the forums. This module is now part of the core so you don't need to install it this way. If you are using PW 2.4 (i.e. the latest version) you should see it under the "Core" tab under /modules/. I believe its called "Languages Support - Tabs" (see category Language)
    2 points
  11. It would be great to have modules selection with submit sites. I would love to see which modules each websites have used!
    2 points
  12. A "top pages" would be great. I would suggest that you make the top pages depending on the number of likes AND the time since the site was submitted. If not, there is the chance that only 3 or 4 pages will gain new votes while other pages can never reach that state. And great to see minimize.pw
    2 points
  13. This is great! Just submitted a few older sites. Marty, you really are a machine! Nice work.
    2 points
  14. 2 points
  15. Hey Pete, I'm short on time, I think this is what you are after. $templates->get("template_name")->fieldgroup->getField($field, true)->label; *written in browser off the top of my head.
    2 points
  16. I agree, that looks great. I'd say it's brilliant even. It's a "P" both in positive and negative space, and the whole thing is constructed from a wire. I'm wondering if the Bitnami folks would mind if we used that elsewhere.
    2 points
  17. I was just reading this post on how to make breadcrumbs in ExpressionEngine (http://bit.ly/hello_crumbly) and how you basically have to resort to a plugin to do it for you. It reminded me of some of the problems I had with EE when I was trying to use it and develop in it awhile back. One being that URLs aren't a primary/unique key to a page, natively in the system. Imagine ProcessWire with only it's root level pages and url segments, and that gives you an approximation of what you have to deal with in EE. I'm not saying it's wrong, but it's a different approach, and one that I found frustrating to work with. The post also made me realize I didn't have anything on the site demonstrating how you might make a breadcrumb trail (other than in the default site profile). It's really a simple thing (at least, relative to EE), so figured I'd post here. : <?php foreach($page->parents() as $parent) { echo "<a href='{$parent->url}'>{$parent->title}</a> "; } You may want to output those as list items or add some >> signs between items, but as far as code goes, the above is all there is to it. What it's doing is just cycling through the current page's parents till it reaches the homepage. Lets say that you also wanted to include the current page in your breadcrumb trail (which is probably redundant, but some sites do it). What you'd do is just append it to the list of parents that gets cycled through: <?php foreach($page->parents()->append($page) as $parent) { echo "<a href='{$parent->url}'>{$parent->title}</a> "; } The reason this is so simple is because every page is anchored to a specific URL and those URLs are representative of the site's actual structure. Pages in PW are actually uniform resource locators (URLs) whether on the front end or the back end. Because of that, there's no guesswork or interpretation to be done. In EE and Drupal (as examples) that data does not natively live at a specific URL. Instead that data is off in a separate container and the ultimate URL (or URLs plural) where it lives–and will be presented by default–are not as cut and dry. Yes, you can install plugins or go through strange taxonomic/channelistic/cryptic trials to approximate the behavior in other systems. And yes you can use url segments and pull/render any other pages you want in ProcessWire according to your own needs. But I'm talking about the fundamental and core system differences. This difference goes far beyond simplicity of generating breadcrumbs–it is a factor that translates to simplicity throughout the API.
    1 point
  18. Hi all! I have created this new module that improve the current search engine on PW: https://github.com/USSliberty/Processwire-site-indexer (Beta version) The main idea is to create an hidden field that store keywords (separated by space). The keywords are generated automatically from all text fields in the page, plus PDFs and DOCs files. So if you create new text fields you can forget to add they on Search Page Module. The only thing to do after install, is to change the list of fields in Search Page (see attachment). In fact you need to search only in "indexer" field. NOTE 1: At this time the module index only when you save the page. In the next week maybe i will add the complete-site re-index. NOTE 2: The files are indexed with 2 Unix packages (poppler-utils & wv). I have tried without success with pure PHP classes, but if know a class that works fine i can add it into module. ADB
    1 point
  19. So, I've been seeing some email-related topics around here and actually had quite a few struggles of my own with this very subject myself lately. Thing is that sending email should be easy, but it's not always that; especially for those who have to work on multiple, low-price (and regrettably often low-quality) platforms that may or may not provide proper mail servers.. or prefer to host their services themselves and still want to avoid setting up and maintaining a mail server. Hosting a mail server can be real pain in the ass when things don't work like they should, not to mention that most people have very little knowledge about DNS entries etc. this requires. Anyway, long story short: yesterday I started thinking that wouldn't it be sweet to have a layer of abstraction within ProcessWire for sending email? Of course one could still use PHP mail() -- there's no way and no sense in even trying to stop that -- but using a common gateway would definitely bring in some extra value. This layer I'm talking about could by default use built-in PHP mail() but also make it possible to override it, thus allowing multitude of options that PHP mail(), being bound to Sendmail / it's alternatives, can't offer without additional server-side software (such as Nullmailer.) By making sending emails hookable it could also enable all kinds of interesting tricks to be done when mail is sent -- such as writing a custom log file, sending another email to someone else, updating local content (I'd imagine that this could be useful for building newsletter platform, for an example) and so on. Since words tend to fail me at times like these, I put together a quick proof of concept of what I'm talking about here, accompanied by one example of what could be achieved by doing this: A very simple yet functional Mailer class Two commits on top here list all the changes I've made in my PW fork to make this work -- including the fact that I've altered some default modules to use $mailer->send() instead of mail() SwiftMailer module, again very simple but fully functional (though only tested with Gmail SMTP) drop-in replacement for PHP mail() So, what do you folks think of this? Please keep in mind that this is just a suggestion and I'm not saying that this is the right path to take especially considering that it would add another API variable -- it just felt like best option here and I couldn't think of cleaner way to achieve it.
    1 point
  20. Hi everyone, Another overhaul today. A few bug fixes and a bunch of new features. I have updated the first post here to detail them better, but key things are the ability to make use of the following variables in the filename format: $page, $template, $field, and $file. To accommodate some of possibilities this opens up, eg: $file->description, there is new logic to handle renaming after page save if the filename format can't be properly evaluated at upload because the field isn't available yet, or is still blank. If possible, renaming will still occur during upload - "on save" is just a fallback if needed. Another key addition is the ability to give each rule the option to rename the file again each time the page is saved. There are obvious issues with this if images or files are being linked directly by their URL, so care is needed with this option checked. It does allow for some incredible flexibility though. You could even have a field in your template called "Filename" allowing the user to rename the file whenever they want. In most scenarios of course this would not be at all desirable, but it suited my needs, so thought it might come in handy for someone else as well If nothing else, it might be useful during development, but could be disabled once the site is live. Let me know if you find any bugs with this new functionality.
    1 point
  21. Hi John, Welcome to PW and the forums. 500 internal errors like that normally point to an Apache error, i.e. something on your server. In addition to Adrian's suggestions, note that some web hosts don't allow some rules in .htaccess file, e.g. these: Options -Indexes Options +FollowSymLinks Options +SymLinksifOwnerMatch Comment those out one by one and see if your site loads. If not, also, check /site/assets/logs/errors.txt although I doubt you'll see anything there at this stage.... Other: if you have access, check your Apache error log Are the folders in your /site/assets/ writable? You actually have a .htaccess file? If you do, rename it temporarily to htacess.txt. Does the problem vanish? If yes, then Apache is definitely unhappy with some rule in your .htaccess file. Are you installing in a sub-directory? Version of PW?
    1 point
  22. 1 point
  23. Really great diogo - fantastic looking site Also, love the meanmenu - I think that is the first mobile friendly menu I've seen with the plus for expanding submenus, thereby avoiding the need for duplicating the parent item - might be my new favourite!
    1 point
  24. To expound on what Apeisa has said... There's a very good write-up by Teppo about Fields and Inputfields over at his blog http://www.flamingruby.com/blog/anatomy-of-fields-in-processwire/ A bit more here: http://processwire.com/api/fieldtypes/ http://processwire.com/api/fieldtypes/validation-fieldtypes-vs-inputfields/ All Fields have a corresponding table in the PW database named like so.. field_title, field_body, field_myfield, etc. Have a look in phpMyAdmin or something
    1 point
  25. Better approach would be autoload module, that will hook into 404 error, and saves hits into a custom db table (instead of fieldtype). See https://github.com/apeisa/ProcessRedirects/blob/master/ProcessRedirects.module module, since it is pretty close (it checks 404:s for redirects). Here is the relevant hook: https://github.com/apeisa/ProcessRedirects/blob/master/ProcessRedirects.module#L20
    1 point
  26. Yup - very nice to see all of these creations, many of which I'd not seen before... but then I do have 12 pages of posts to catch up on again!
    1 point
  27. I just thought of a way to implement a statically-typed event sink in PHP - check it out: http://www.tehplayground.com/#hh9WpisbY This has a couple of interesting properties - primarily the fact that you can register listeners without passing a class-name or method-name as a string, but also the type-hints would get you IDE support, e.g. auto-complete and safe refactoring in PhpStorm. I'm using a "hack" to delay auto-loading as well - it turns out, by parsing the type-hint with a regular expression applied to the string-representation of a ReflectionParameter (of the registered closure) you can avoid auto-loading until the registered closure actually gets called. In other words, you can register listeners without auto-loading the class that implements the message it's listening for - that is, $sink->register(function(Foo $foo) {}) will not cause class Foo to auto-load, which means you could register all your global listeners of every module on start-up without the overhead of loading any additional classes. I don't think this really fits with the existing concept or architecture in ProcessWire, but it seems like an extremely powerful idea, and I figured, if somebody is going to find this idea useful, this might be the right place to post it. Anyhow, there it is
    1 point
  28. Don't understand a word of it myself.
    1 point
  29. @mindplay I've been hacking at this on "teh playground" and quite like it. Here is a hacked take at extending your idea (with more of an Événement naming scheme as I'm more familiar with it.) - Functions return $this so you can chain calls. - Event sinks have an invocation lifespan - (you can setup a one-shot sink, n-shot or infinite sink as required.) - If a sink returns an event, it is stacked up for handling, allowing multiple sinks for an event. I'm not sure what you intended to happen in the case of multiple sinks for an event but I found that when the first sink returned a new event, it was preventing the second sink getting a chance to handle the initial event. That could be totally valid, effectively allowing the sink to mutate the event as it passes through but I decided to try it with a stack to give every sink the chance at seeing the event. Either way. this is pretty interesting. Thanks!
    1 point
  30. But thats for HTTP requests, I dont think PHP even uses that if you include a file? Since its called UrlRewrite. I'll try it this afternoon or tomorrow with the 2.4 on a webserver (If i can get one in time) I doubt that its inpossible top include files since if you just include a php file on a template it works too. EDIT: Did you make a page for Login? ill try and upload a complete 2.4 version with the module installed so that you can see what we did different. Give me half an hour EDIT2: I am a bit confused about the behavior of the HybridAuth... It takes me a bit longer EDIT3: I've encountered the same problem. I think I need to find a fodler that doesnt have that restriction but I cant seem to find one...
    1 point
  31. I think these threads answer your question: http://processwire.com/talk/topic/4812-field-names-using-arrays/ http://processwire.com/talk/topic/691-wireinput-only-allows-one-dimensional-arrays-why/ Just use $_POST instead.
    1 point
  32. Cool one Reno ! I was still scrabbling with pete's puzzle...
    1 point
  33. Nice one Reno. I just tested and it works! My quick mash - I am sure it could be improved. $template = $templates->get("your-details"); foreach ($template->fields as $field) { $fieldlabel = $template->fieldgroup->getField($field, true)->label; echo "<label for='$field->name'>".$fieldlabel."</label>"; $inputfield = $field->getInputfield($page); echo $inputfield->render(); }
    1 point
  34. At which point exactly does it simply explode?
    1 point
  35. Thanks for submitting your sites! We're now up to 106 sites in the sites directory. Keep them coming! I added the FieldtypeLikes module so that you can now click "like this site" for any of them (this is also used in the modules directory for the recommendations feature). I figure this will be useful for sorting and ensuring that some of the best examples of PW sites rise to the top, down the road. Perhaps we'll display the top 3 on the homepage or something. Currently "most liked" is a sort option, but default sort is by date modified. Anyway, if there are any sites you think are especially good examples in the directory, please go there and like them. The other addition is that the sites directory now uses Philipp's excellent ProcessImageMinimize module for all the screenshots.
    1 point
  36. if you assign level1 = 1 and then try to print an array i doubt it will work since you assigned an int or even a bool (Since 1 could also be true) and you try to print an array If you wish to print it should work with $level1 = array(1); That and i dont really understand your question, try and formulate your question instead of just stating a line and another line.
    1 point
  37. Wow first time I see it! Looks great there!
    1 point
  38. JFYI, the packaging is now ready, and ProcessWire is available as bitnami images: blog.bitnami.com/2014/02/processwire-added-to-bitnami-library.html So, now it's time to share share share!
    1 point
  39. Doh... Solved my own problem.... Changed this... foreach($page->comments as $comment) To this... foreach($comments as $comment) Sorry for diverting you here... but thanks for looking! Here is what I have ended up with... // DISPLAY PAGINATED COMMENTS $limit = 10; // comments to display per page $start = ($input->pageNum-1) * $limit; $selector = "page=$page, sort=-created, start=$start, limit=" . ($limit+1); // find the comments. replace "comments" with the name of your comments field $comments = FieldtypeComments::findComments("comments", $selector); // output the comments foreach($comments as $comment) { if($comment->status < 1) continue; // skip unapproved or spam comments $cite = htmlentities($comment->cite); // make sure output is entity encoded $text = htmlentities($comment->text); $date = date('m/d/y g:ia', $comment->created); // format the date echo "<p>Posted by $cite on $date<br />$text</p>"; } // output the pagination links if($input->pageNum > 1) echo "<a href='./page" . ($input->pageNum-1) . "'>Back</a> "; if(count($comments) > $limit) echo "<a href='./page" . ($input->pageNum+1) . "'>Next</a>"; Thanks guys
    1 point
  40. Oh good! All that typing from everyone is definitely worth it then!
    1 point
  41. I think Kongondo has it mostly right. But for the sake of keeping it simple, maybe ignore the part about making a copy of the AdminThemeDefault for the moment, and just make your edits to AdminThemeDefault. Once you've got them in place, you can always copy it to a different admin theme in /site/modules/ if you want to. But lets get down how to add color themes first. 1. Add your new color theme option to the AdminThemeDefault.module file like Kongondo mentioned. 2. Go into /wire/modules/AdminTheme/AdminThemeDefault/styles/sass/ and copy _vars.scss to _colors-pete.scss. The _vars.scss is based around the Warm color theme. If you prefer to use a different one as a starting point, then copy _colors-classic.scss (for example) to _colors-pete.scss instead. 3. In the same directory, edit the main.scss file and add your new colors file, making sure the others (except 'vars') are commented out: @import 'vars'; @import 'mixins'; //@import 'colors-classic'; //@import 'colors-modern'; //@import 'colors-futura'; @import 'colors-pete'; // ADD THIS LINE 4. Make edits to your _colors-pete.scss file as you see fit. You don't need to know Sass to do this, as everything is predefined with Sass variables that you can just insert new color values into it. However, read the following steps first, as you may want to setup your Sass watch to keep an eye on the changes for you as you go, so that you can see them take place in your browser as you make them. 5. Compile the styles/sass/main.scss file to styles/main-pete.css using whatever method you prefer. The standard method would be to use Sass watch. If you were currently in your styles/ directory, you could type this at the command line to automatically compile changes to main-pete.css. sass --watch sass/main.scss:main-pete.css This will keep running indefinitely, monitoring for changes and compiling them to main-pete.css every time a change is made to any one of the scss files. If you only wanted it to run once, then you'd just omit the "--watch" part. 6. Before or while you are making changes to your _colors-pete.scss file, go ahead and login to PW admin and go to Modules > Core > Default Admin Theme. Click "Settings" and change the color theme to "Pete", so that you can see your changes as you go.
    1 point
  42. I don't exactly know what's going on here but it sure sounds cool
    1 point
  43. I've written probably three dozen event sink prototypes over the past 6-7 years, and I think I may have finally found what I'm looking for. Taking it one step further, check this out: http://www.tehplayground.com/#dpQwxg8wF The submit() method now (optionally) accepts a closure that produces the actual event - this allows for even more "laziness", since it can check if anybody is listening before the event is even created. (Because this is done by constructing the actual event object inside the event sink, this will only work for event objects with empty constructors, but I have the opinion that event constructors should always be empty, so I'm happy with that, and the performance advantage here could be huge.) I also made it possible for listeners to return an event object, and the returned event will be broadcast immediately. And above all, it's still simple
    1 point
  44. Thanks! I've been lurking in the shadows for awhile now and working on my first big project. I'm loving it more and more. That worked like a charm. When I'm done with this project, I'm going through each line of code to see if I can become fluent. I'm like a kid in a candy store with this CMS.
    1 point
  45. You can go to Settings on the page you are editing and there is a "Created by User" field that you can change to the user you want to be the author.
    1 point
  46. Hi 3fingers, Here is the code that processes the form: https://gist.github.com/outflux3/5690429 here is the form itself: https://gist.github.com/outflux3/5690423 i didn't post the form results, but that's just a table that shows the results; hopefully the processor and form code will help! -marc
    1 point
  47. PW's coding style is visible in any core file. But it's the same idea whether we're talking about code, graphic design, architecture or really anything someone would create: When it comes to code, that translates mostly to not adding extra unnecessary bytes: Avoid having an opening bracket "{" on its own line. Instead, just use a single space before an opening bracket. Only closing brackets "}" should be on their own line. Avoid use spaces for indentation, just tabs. This is what tabs were made for, not spaces. Use just one tab per indentation, of course. Avoid extra spaces around parenthesis unless you think it's really necessary. For example, it's preferable to use function(a, b) not function ( a, b ) Put a space after a comma, just so the comma doesn't visually melt into one of the adjacent letters. Don't put a closing PHP tag "?>" at the end of a file. Use camelCase for most variable and function names except for when the variable resolves to a database column or ProcessWire 'name', then use lowercase and underscores. Use camelCase for class names except always have the first character be uppercase, i.e 'CamelCase' (there may be a more specific term for this). Put a space before and after the concatenation operator, as it's small and disappears (or becomes a sentence period) too easily. For example use "a . b" and not "a.b". And of course, comment as much as possible. Comments are bytes that are always appreciated for communication. Outside of internal comments within the body of functions/methods, PHPdoc style is the standard we prefer. Honestly the biggest one for me is just the opening bracket thing. I can't follow code that contains opening brackets on their own line. It makes the opens and closes so visually similar that I can't can't easily tell them apart. It could be that my eyes aren't great, but at least for me that coding style creates legibility problems. I have to "fix" code before I can read it. With the style I'm using, when I see a bracket on a line (before I see the nuances of the serifs), at least I know it is always closing something.
    1 point
×
×
  • Create New...