Leaderboard
Popular Content
Showing content with the highest reputation on 06/07/2017 in all areas
-
Couldn't you create a new "Fieldset in Tab" and place the desired fields within the tab when editing the template?4 points
-
@Kiwi Chris Sounds interesting! Take this small file information module as a first approach. Furthermore there is this related old and (unsupported?) module in the modules directory: http://modules.processwire.com/modules/manage-files/ Have fun with coding. <?php namespace ProcessWire; class AdminFileInfo extends WireData implements Module, ConfigurableModule { /** * * @return array * */ public static function getModuleInfo() { return array( 'title' => 'Admin File Info', 'summary' => __('Overview of all Pagefiles living under a specific branch'), 'href' => '', 'author' => 'kixe', 'version' => 100, 'icon' => 'files-o' ); } /** * Initialize, attach hooks * */ public function init() { } /** * create Info Table * */ static public function getInfoTable($parentID = 1) { $treePages = wire('pages')->find("has_parent=$parentID,include=all"); $table = wire('modules')->get('MarkupAdminDataTable'); $table->headerRow(array('PageID','Filename','size')); $table->totalSize = 0; // byte counter // @todo Notice: Undefined offset: 1 in /Users/c/Sites/_processwire/wire/modules/Markup/MarkupAdminDataTable/MarkupAdminDataTable.module on line 276 foreach ($treePages as $singlePage) { if (PagefilesManager::hasFiles($singlePage) == false) continue; // no files $pageFileNames = $singlePage->filesManager->getFiles(); // get all files of this page foreach ($pageFileNames as $pageFileName) { if(null === $file = $singlePage->filesManager->getFile($pageFileName)) continue; // orphaned stuff $table->totalSize += $file->filesize; $table->row(array("#$singlePage->id" => $singlePage->editUrl, $pageFileName => $file->url, wireBytesStr($file->filesize))); } } return $table; } /** * module settings * */ static public function getModuleConfigInputfields(array $data) { $modules = wire('modules'); $parentID = isset($data['parent'])? $data['parent']: null; $fields = new InputfieldWrapper(); $f = $modules->get('InputfieldPageListSelect'); $f->attr('id+name', 'parent'); $f->attr('value', $parentID); $f->icon = 'tree'; $f->label = __('Page Tree Parent'); $f->description = __("Select a parent page and click submit to get information about all files under this tree."); $fields->add($f); if ($parentID) { $page = wire('pages')->get($parentID); $table = self::getInfoTable($parentID); $f = $modules->get('InputfieldMarkup'); $f->label = __('File Info for Page Branch: ').$page->path; $_description = __("This page branch uses %s of storage space for files."); $f->description = sprintf($_description, wireBytesStr($table->totalSize)); $f->value = $table->render(); $fields->add($f); } return $fields; } }4 points
-
This is my second project based on processwire. I love it. Please share your meanings http://baumaschinen.guru3 points
-
2 points
-
@thetuningspoon, the below seems to work well with any of the SQL LIKE operators. You could easily add it as a new $sanitizer method via hook if you wanted. Test title: Code: function prepSelectorValue($str) { return '"' . addslashes($str) . '"'; } $p = $pages(1107); // the page with the test title $title = prepSelectorValue($p->title); $items = $pages->find("title%=$title"); echo '<h2>Results</h2>'; echo $items->each("<p>{title}</p>"); Result:2 points
-
http://lmgtfy.com/?q=processwire+message+system the first hit is this thread....with thoughts, examples and solutions....;) Regards mr-fan2 points
-
3 years PWired, but PW still surprises. Right marriage.2 points
-
FieldtypeRuntimeMarkup and InputfieldRuntimeMarkup Modules Directory: http://modules.processwire.com/modules/fieldtype-runtime-markup/ GitHub: https://github.com/kongondo/FieldtypeRuntimeMarkup As of 11 May 2019 ProcessWire versions earlier than 3.x are not supported This module allows for custom markup to be dynamically (PHP) generated and output within a page's edit screen (in Admin). The value for the fieldtype is generated at runtime. No data is saved in the database. The accompanying InputfieldRuntimeMarkup is only used to render/display the markup in the page edit screen. The field's value is accessible from the ProcessWire API in the frontend like any other field, i.e. it has access to $page and $pages. The module was commissioned/sponsored by @Valan. Although there's certainly other ways to achieve what this module does, it offers a dynamic and flexible alternative to generating your own markup in a page's edit screen whilst also allowing access to that markup in the frontend. Thanks Valan! Warning/Consideration Although access to ProcessWire's Fields' admin pages is only available to Superusers, this Fieldtype will evaluate and run the custom PHP Code entered and saved in the field's settings (Details tab). Utmost care should therefore be taken in making sure your code does not perform any CRUD operations!! (unless of course that's intentional) The value for this fieldtype is generated at runtime and thus no data is stored in the database. This means that you cannot directly query a RuntimeMarkup field from $pages->find(). Usage and API Backend Enter your custom PHP snippet in the Details tab of your field (it is RECOMMENDED though that you use wireRenderFile() instead. See example below). Your code can be as simple or as complicated as you want as long as in the end you return a value that is not an array or an object or anything other than a string/integer. FieldtypeRuntimeMarkup has access to $page (the current page being edited/viewed) and $pages. A very simple example. return 'Hello'; Simple example. return $page->title; Simple example with markup. return '<h2>' . $page->title . '</h2>'; Another simple example with markup. $out = '<h1>hello '; $out .= $page->title; $out .= '</h1>'; return $out; A more advanced example. $p = $pages->get('/about-us/')->child('sort=random'); return '<p>' . $p->title . '</p>'; An even more complex example. $str =''; if($page->name == 'about-us') { $p = $page->children->last(); $str = "<h2><a href='{$p->url}'>{$p->title}</a></h2>"; } else { $str = "<h2><a href='{$page->url}'>{$page->title}</a></h2>"; } return $str; Rather than type your code directly in the Details tab of the field, it is highly recommended that you placed all your code in an external file and call that file using the core wireRenderFile() method. Taking this approach means you will be able to edit your code in your favourite text editor. It also means you will be able to type more text without having to scroll. Editing the file is also easier than editing the field. To use this approach, simply do: return wireRenderFile('name-of-file');// file will be in /site/templates/ If using ProcessWire 3.x, you will need to use namespace as follows: return ProcessWire\wireRenderFile('name-of-file'); How to access the value of RuntimeMarkup in the frontend (our field is called 'runtime_markup') Access the field on the current page (just like any other field) echo $page->runtime_markup; Access the field on another page echo $pages->get('/about-us/')->runtime_markup; Screenshots Backend Frontend1 point
-
Hi everyone I´m creating an AdminTheme based on Semantic UI framework. Here is the beta version. I 'm fixing bugs. Github here Changelog: 0.0.1 --- Fixed background color / image.1 point
-
Hi, Wondering if anyone's ever built a private messaging system or if there are any plans for one? Thanks!1 point
-
Hi, I've noticed when I trash pages from a PageTable field, then restore them, they are restored to their original location, however the connection is broken with the PageTable field. Is this expected behaviour? Is there a way for it to maintain this relationship? Otherwise restoring it doesn't actually restore it to it's previous state. Note that in this case the parent pages for the PageTable field is not set as the direct parent.1 point
-
I think your issue is not due to any general problem with adding plugins for CKEditor, but due to the fact that images in PW must be stored in an image field. CKEditor is a third-party tool so by itself it doesn't have any idea about PW image fields. Theoretically a person could make a custom CKEditor plugin that could add images to a PW image field but to my knowledge no such plugin is available. So for now you will need to first add your images to an image field and then add them to CKEditor from there.1 point
-
I not sure and even didn't test it, but you can try to use $field->set('parent_id', '1084'); $field->set('template_ids', '[74]'); $field->set('findPagesSelect', 'test=somevalue'); $field->set('findPagesSelector', 'modified_users_id=40, status=hidden');1 point
-
Sorry about that, I fully understand. You can also try the Legacy Version 2.8.62. "Same as 3.x but without namespace, for full 2.x compatibility." Upgrading from ProcessWire 2.7 Upgrading from 2.7 to 2.8.x Login to the admin of your site. Edit your /site/config.php and set $config->debug = true; to ensure you can see error messages. Replace your /wire/ directory and /index.php file with the ones from here. When you've confirmed a successful upgrade: Replace your .htaccess file with the included htaccess.txt file, OR if you have made changes to your .htaccess file, you may want to apply any changes manually (see instructions in section above). Remember to restore the $config->debug setting back to false in your /site/config.php file.1 point
-
I'm pretty comfortable with Processwire templates, and I've found to date existing modules have met my requirements, but I've run into something where I think I'm going to need to create a module. The scenario I have is a site with sub-sites, which are basically just pages in the page tree that use a 'Subsite' template, and are assigned to different people to edit using the Admin Restrict Branch module from the module directory. What I want to be able to do is check how much disk space each sub-site is using for associated files. I figure I can iterate over the PageFiles array for each page that uses the 'subsite' template, and its children. This won't be 100% accurate as some images may have different sized variations generated by Processwire templates. This possibly isn't too much of a problem, as I'm not really needing a completely strict limitation on disk space, but at least I want to track how much space has been used directly via uploads. The bit I'm unsure about is how to go from knowing how much space is used by uploaded files for a page and its children, to getting that value to display on the admin screen when editing a page, and ideally, to prevent further uploads if a sub-site has reached a configurable limit, which may vary for different sub-sites, although initially, just having a common limit for all sub-sites would be a good start. I'm thinking I might need to hook into the PageFilesManager, but given this will be my first attempt at building a module, any guidance would be appreciated.1 point
-
1 point
-
Also resolved it for the other hoster. Same, but with RewriteCond %{HTTP:X-Forwarded-Proto} !https added. So RewriteCond %{HTTP:X-Forwarded-Proto} !https RewriteCond %{SERVER_PORT} 80 RewriteRule ^(.*)$ https://www.domainname.tld/$1 [R=301,L] And RewriteCond %{HTTP_HOST} ^domainname.tld$ RewriteRule ^(.*) https://www.domainname.tld/$1 [QSA,L,R=301] NB: the redirection from https:// to https://www seems to work better when keeping RewriteCond %{SERVER_PORT} 80 after adding RewriteCond %{HTTP:X-Forwarded-Proto} !https Tested several times, with the cache cleared. Perhaps a coincidence, or not... I was just curious to see what would happen if I removed it.1 point
-
Some hosts don't like 777 permissions - I suggest you change all directories to 755 and all files to 644 (apart from /site/config.php which should be more restricted). A good FTP client will be able to change permissions recursively, with separate permissions for directories and files. Another thing that could cause your issue is lack of disk space - check to make sure you haven't run out.1 point
-
Howdy again The last quote gives you the cause of the error, destination path is not writable. <-- The permissions of your folder structure are not correct, and ProcessWire can't write to the destination. In your /site/config.php file is listed the permissions ProcessWire needs, as shown below. /** * Installer: File Permission Configuration * */ $config->chmodDir = '0755'; // permission for directories created by ProcessWire $config->chmodFile = '0644'; // permission for files created by ProcessWire I'm not sure what control panel you are using to access your document root, but most, if not all, have some mechanism to set/change permissions. In your /site/ folder, you will see a folder named, assets. Select this folder and then set the permissions for it and ALL folders and content below it. That should do it. Post back if you have any more questions.1 point
-
hi kass, it could also be an option to do something like this (pseudocode): <?php $page; // current page being displayed $active = $page->parents->add($page); // all parents of current page + page itself if($active->has($page)) echo 'class="active"'; didn't read your post deeply but maybe that's a point in the right direction good luck1 point
-
Hi @Kass Solution mostly depends on your menu implementation. As for me, when I have some complex menu system, usually I build it with repeater field. For every menu item I have Selector field ( InputfieldSelector ) where I define selector when current menu item will be active, and then in my code I use $page->matches($selector); https://processwire.com/api/ref/page/matches/ In that way, I can set the active state for every menu item even if the current page is not under current parent.1 point
-
It works with that directive added. Thanks flydev! So the formula to install Processwire on Ubuntu on Amazon EC2: sudo apt-get update && sudo apt-get upgrade -y sudo apt-get install apache2 sudo apt-get install lamp-server^ sudo apt-get install php7.0-zip sudo a2enmod rewrite sudo apt-get install phpmyadmin sudo ln -s /usr/share/phpmyadmin /var/www/html/ sudo adduser ubuntu www-data sudo chown ubuntu:www-data -R /var/www sudo chmod 2775 -R /var/www sudo find /var/www -type d -exec chmod 2775 {} + sudo find /var/www -type f -exec chmod 0664 {} + sudo service apache2 restart Then add this directive to your VirtualHost in /etc/apache2/sites-available/000-default.conf : <Directory /var/www/> Options Indexes FollowSymLinks AllowOverride All Require all granted </Directory> And then it should all work. ...still have to see it working with my custom exported profile, but that is my problem. (Edit: that was caused by syntax errors in my custom templates, unsupported use of short_tags.)1 point
-
You can currently do this by modifying or extending the CommentForm class. Copy /wire/modules/Fieldtype/FieldtypeComments/CommentForm.php to your own location, like in /site/templates/includes/ or something like that. Then rename the class to be something else, like "CommentFormMichael" or whatever you'd like it to be named. Modify the class to suit your needs. Then when you output your comments, use your class rather than the one that comes with PW: echo $page->comments->render(); require("./includes/CommentFormMichael.php"); $form = new CommentFormMichael($page, $page->comments); echo $form->render(); This same approach can be taken with the comments list rendering too, except that you would copy or extend the CommentList class rather than the CommentForm class.1 point