Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 08/08/2015 in all areas

  1. I know you said you didn't want to use a selector, but I'm just wondering why on earth? You are effectively doing the same as $items = $pages->find('name=page-1|page-2|page-3|page-4|page-5, parent=/'); But your code will just execute slower.
    4 points
  2. Tutorial in German, with videos: http://frankmaier.net/tutorials/processwire/ Migration to PW Article: http://www.jubatian.com/articles/migrating-to-processwire/
    4 points
  3. Simply put, there is absolutely no reason to go with Drupal in the situation you described. ProcessWire can easily handle your requirements. As a bonus, you will have fun at it! I'll also clear few misconceptions. ProcessWire can easily handle hundreds of thousands of pages, so you don't need to worry about that. What you need to worry about is the design of your templates, fields and relations. Making wrong selections there can severely impact the performance of the site. And even then, the community is happy to help if you face performance issues User registration won't be a problem either since users in PW are basically just pages. You can even extend the built-in 'user'-template with more fields.
    3 points
  4. @thetuningspoon: There is only one way to extend the Page -class, e.g. <?php class MyPage extends Page { public function myFunction() { return "I have been created for great endeavours" } } ?> After you have made sure the class exists (preferrably through autoloading), you just enter the name of the class into the 'System' -tab of the template in question (under "Page Class Name").
    3 points
  5. Quickly toggle your checkboxes with extra action buttons via AJAX. The module adds functionality to InputfieldCheckbox so you can toggle the checkbox fields in the extra action buttons intruduced in ProcessWire 2.6.5 via AJAX. Github Page Download Link Requirements This module works only for ProcessWire versions later than 2.6.5. How to Install 1. Copy the files to /site/modules/ProcessQuickToggle/ 2. In your admin, go to Modules > Refresh for new modules. 3. Click the "Install" button next to "Process Quick Toggle". Usage Go to any checkbox field you want to enable quick toggle feature for. Setup > Fields > my_checkbox_field. There in the Input tab you should see an Enable Quick Toggle field. After you check it you will see some fields that you can fill based on your needs. Then save the field. Now there should be an extra button for every page that has this field in the Pages tree. Features Supports template contexts. Supports core FontAwesome icons. Any kind of feedback is appreciated.
    2 points
  6. Comonly i create list > item template combinations. Like agenda list containing agenda items as children, or a news list containing news items. Now in most cases the list templates title would be set once (Agenda / News) and after that does not have to be editable (or my wish to be hidden). For that it would be nice to have an extra choice in the field visibility settings: Open when blank, hidden when populated So that while creating the page, the developer can set the title whichafter it wont be shown anymore, thus not being able to modify it. I can do this manualy, create all the list pages and then modify the template setting the title field to hidden for the specific fieldgroup.
    2 points
  7. @Adrian, great advice and thank you. I am definitely going to move everything to processwire versus having two systems for one company. I rather have them login once, and control what they need to control. Thanks again!!!!
    2 points
  8. I just added the “replace new line with a space character” before the two other rules of the original Thinspace module do their work: public function format(&$str) { $str = preg_replace('/\n/u', ' ', $str); $str = preg_replace('/(?:\x{20}|\x{a0}){2,}/u', ' ', $str); $str = preg_replace("/\n{2,}/u", "\n", $str); } E. g. the combination “space + line break + space + line break” will be converted into “space + space + space + space” in a first step and then into a single “space” in a second step. To have optimal content for meta elements which have a length limit, I create separate fields on a separate tab and use the Textarea Counter module. Of course i always include fallbacks in my templates. So if a description field is not filled with text, there are multiple fallback steps – ending with a “nice break” extract from the page’s main body text.
    2 points
  9. Or do what I do - don't even both with the actual search functionality - just do a CTRL or CMD + F and type: ->of and let the browser find the text on the page.
    2 points
  10. Because I wanted to be able to strip all line breaks from a textarea field and then apply the Thinspace textformatter, I forked Netcarver’s module, added the required line and simply called it “Thinspace Plus” (which is not very creative, I know): https://github.com/MichaelvanLaar/PW-TextformatterThinspacePlus I use this Textformatter mostly for textarea fields that contain meta descriptions and similar content. The reason I use textarea fields here – instead of simple Text fields – is that I want to be able to use the great Textarea Counter module with these fields. But since these fields are intended to be simple strings without any line break or paragraph formatting, I want to “flatten” them – just in case an editor enters a line break. OK, the line breaks probably won’t do any harm in meta descriptions, OpenGraph descriptions, etc. But I just want to see them in my rendered source code ;-)
    1 point
  11. Minor note regarding the 404 monitor: currently all hits to sitemap.xml (generated by Pete's Markup Sitemap XML module) are recorded as 404s. Haven't had a proper look under the hood yet, but so far I'm guessing that both modules hook into pageNotFound, in which case this sounds like a priority issue or the logger not checking if another module has modified the output (however that should be implemented). Anyway, just something you might want to consider for the new 404 logger module. For the record, the 404 logger is very handy when migrating a lot of content from one site to another, and it's also cool that one can easily register a new Jumplink from the 404 list. Great work, just like the rest of this module!
    1 point
  12. Once the blog posts are imported, they will run just like other PW pages. The import itself is the only potentially tricky part. MigratorWordpress is configurable to match the names of the pages/templates/fields of kogondo's blog module, but if that isn't installed, then it will create all those pages/templates/fields itself. It will even import and create the users from the WP blog and assign the posts to the appropriate user. Once again, just test on a test PW site first so you learn all the options and make sure they are no conflicts / issues.
    1 point
  13. Hi Martin, if the filesize limit is 50 MB, the post_max_size should be a bit higher. I think it has to do with that post data is encoded so that the final post data is always greater than the original binary file data. Can you try upload_max_filesize 50M and post_max_size 65M?
    1 point
  14. this line will not work I believe: $p->parent = wire('pages')->get('/$parent/'); //set the parent '/$parent/' : if you use it with a variable as shown in your code, you must surround it with doublequotes: "/$parent/". Variables will not be populated within singlequotes. ------ Where is the code (line) where you check for existing records? Are there unique fields in your drupal data with the records that you can use? steps to do: 1) read (next) record from drupal source 2) fetch and prepare data for a unique identifier from it This can be a unique field within the drupal data, or, if this is not present, create a selector that may contain sanitized values for name / author / date or what is the best for your data. 3) do a get() with this selector If the page exists, modify it where needed or move on to the next record. If it do not exist, create it and populate fields.
    1 point
  15. Quick response: For changing the user of a page try: $p->created_users_id = $authorID; $p->save(array('quiet' => true)); If you also want to set the modified user you may need to use some SQL, although I think quiet save works for this also in newer dev versions of PW: $sql = "UPDATE `pages` SET `modified_users_id` = '".$authorID;."' WHERE `id` = '".$p->id."';"; $update = wire('db')->query($sql); Keep in mind that if you find you need to use the SQL approach, it will need to be executed after the last saving of the page or it will be overwritten.
    1 point
  16. guess i'm the someone else.. after just having built several blogs with PW, i do wonder why anyone would willingly use that awful WP interface, and the annoying media manager, not to mention things like featured image etc.. i guess for power bloggers, WP probably has some advantages, but most of my clients just need a simple blog that they can edit quickly and easily..
    1 point
  17. Pete has a nice option, here's an other: You could make a dedicated template for the header and the footer and include those. You could template cache or pro cache it! include('http://www.processwire-install.com/header/'); include('http://www.processwire-install.com/footer/');
    1 point
  18. Indeed. It wasn't many pages it applied to (maybe 70) but there are about 10-15 float fields in the template that need changing so yep - best to double-check these things before destroying a client's data!
    1 point
  19. Hi Beluga, I quickly added some code snippets to the documentation. https://bitbucket.org/pwFoo/frontenduser/wiki/Documentation#markdown-header-code-snippets-examples Sorry, but during vacation I was online with my mobile. So I haven't searched this topic for code snippets before I answered
    1 point
  20. The source is on GitHub, knock yourself out https://github.com/mindplay-dk/SystemMigrations
    1 point
  21. Now after working quite a while with it, the only thing what is bother me a bit is that when I hide the left menubar by clciking the hamburger-icon and save a page, it is visible again. It should remember the last state and only should change back when clicking again the hamburger icon. Otherwise really love and use many of the features!
    1 point
  22. Some ideas I recently had to make it even better: Resort the icons and searchbar at the top right corner: (P.S.: In this case you would have to add a border at search suggestions right side, too) Select menu for "Pages" in configuration (Tree, Lister, Both (dropdown)) I never use "Lister" so it would be much better for at least me if I could choose that pages directly takes me to page tree. Don't need a accordion here. But maybe other people. So a config option would be the best, I guess.
    1 point
  23. I use that kind of stuff in every project. Here is one of my "MarkupRenderHelper" modules (stripped some code to make it easier to follow - might throw few errors because of that, but should give the idea): <?php class MarkupRenderHelper extends WireData implements Module { public static function getModuleInfo() { return array( 'title' => 'Render Helper', 'version' => 100, 'summary' => 'Simple module that adds few methods to Pagearray and Page object. -Antti', 'singular' => true, 'autoload' => true ); } public function init() { $this->addHook('PageArray::renderArticleList', $this, 'renderArticleList'); $this->addHook('Page::renderListItem', $this, 'renderListItem'); $this->addHook('Page::renderTags', $this, 'renderTags'); $this->addHook('Page::renderMeta', $this, 'renderMeta'); $this->addHook('Page::firstImage', $this, 'firstImage'); } public function renderArticleList($event) { $articles = $event->data['object']; $out = "<ul class='acticles-list'>"; foreach($articles as $p) { $out .= $p->renderListItem(); } $out .= "</ul>"; $event->return = $out; } public function renderListItem($event) { $p = $event->data['object']; $parent = $p->parent(); $out = ""; $img = $p->firstImage(); if ($p->author) $author = $p->author . ","; $out .= "<li class='$parent->name'>"; if ($img) { $img = $img->width(130); $out .= "<img src='$img->url' width='$img->width' height='$img->height' alt='$img->description' />"; } $out .= "<div class='text-holder'>"; $out .= $p->renderMeta(); $out .= "<h2><a href='$p->url'>$p->title</a></h2>"; $out .= "<p>$p->summary</p>"; $out .= "</div>"; $out .= "</li>"; $event->return = $out; } public function renderMeta($event) { $p = $event->data['object']; $parent = $p->parent(); $author = ($p->author) ? $p->author . "," : ""; $out = "<span class='meta'><a href='$parent->url'>$parent->title</a> $author $p->publish_date </span>"; $event->return = $out; } public function renderTags($event) { $p = $event->data['object']; $out = ''; foreach($p->tags as $tag) { $out .= "<a href='$tag->url'>$tag->title</a>"; if ($tag !== $p->tags->last()) $out .= ", "; } $event->return = $out; } public function firstImage($event) { $p = $event->data['object']; if (count($p->images) > 0 ) { $img = $p->images->first(); } else { $img = false; } $event->return = $img; } } Sometimes I add "widgets" for $pages object too. Then I can just do <?= $pages->renderInfobox() ?> or something like that.
    1 point
×
×
  • Create New...