Leaderboard
Popular Content
Showing content with the highest reputation on 04/14/2015 in all areas
-
Hello again everyone. The latest web that I made for a real estate company www.grupoolmos.com. I am proud of code but not with the design. ; ) I created two modules for the backend. One based on jQuery datatables by soma for managing clients and relate properties (what the customer is looking ? What properties are available? ) This information can be sent by email , etc Another module is for the dashboard (a simple module process) .7 points
-
Actually it gets even simpler than that: $statusLabels = $page->status(true); $statusLabels is an array of names/labels applicable to the page.7 points
-
I spent way too much of my spare time with trying to produce an overly complex site backup module. Anyway - it is here in a pre-release state. I somehow have to get rid of the monster. Features: Use Storage Providers There are two base classes for Storage modules and three reference implementations: Remote Storage Driver This is a baseclass for construcing plug-in modules that allow to send data to a remote storage. You need to extend all abstract functions: connect, disconnect, upload and getConfigFieldset Implemented Examples Storage Mail Sends a backup as mail attachment. If the file size exceeds a set limit it will get split. It uses PHPMailer library as WireMail does not support attachments. @todo: For now this mails all in a single smtp session - maybe thats not so safe? Remote Directory Driver This is a baseclass for construcing plug-in modules that allow to send data to a remote storage and list and delete old files. You need to extend all abstract functions: connect, disconnect, upload, find, size, mdate, delete and getConfigFieldset. Implemented Examples Storage FTP Allows to connect to an ftp server and upload, list and delete files. Uses standard php ftp functions. Storage Google Drive Allows to connect to google drive server and upload, list and delete files. Uses the php google api. You have to create a Service account with the google developers console and add the key file to the plugin directory (or another directory if you specify a relative or absolute path to that file). s. https://developers.google.com/identity/protocols/OAuth2ServiceAccount#creatinganaccount I don't use the OAuth token process because it is not more secure. Once there is a renew token (which is necessary to avoid user interaction) it is as powerful and insecure as a keyfile. It is just more complex as it needs a callback url for registering. @todo? In case you can prove otherwise I will implement the callback registration. Run from the web or the command line It's allways better to have a regular cron job running. But sometimes you might need webcron Command Line You just need to call backup.php with the id of a backup job and it will be run Web Cron There is a token that starts the backup job from the web if passed as a url parameter. You can specify whether you want logging the http stream or not. You can also specify whether you want a job to be repeated within a certain timespan. This is for using unreliable webcron services by hitting the backup multiple times. @todo Consider integration of cron.pw @todo I use the init function of an automatically loaded module as a hook. This seems a bit strange. Is there better ways to do that? Log to mail, file and admin You can recieve logs by mail (on success or failure), log to a file and see log in a an admin page: Configure I built a admin interface that - besides the log viewer - features a list of jobs: and an editor for the job (which is too extensive to be described in detail): Dicussion I am not too sure on how to solve the issues indicated with @todo. My main concern are the hooking (init of an autoload module for the moment) and locking (none, no singleton for the moment). As for hooking I only know of the alternative of using a page where one would have (afaik) to use a special template as the admin template is secured or hook into the security functions (which would probably call for a singleton module). Concerning the locking issue I think it might be good if the Admin Class would lock if it is updateing something. For the moment this is the same class that runs the backups thus it would also lock the admin if there is a backup running. And it would lock the whole site if it is on autoload (as I use the init hook). Lastly I should reconsider the logging and maybe try to better integrate it with processwire logging. I would appreciate comments and suggestionsn on these issues. I appreciate your test results. Don't be took frutsrated if something goes wrong, this is at an early stage but afaik it should be running. Please find the modulle on: https://github.com/romanseidl/remote-backup5 points
-
Isn’t it just this? $out = array(); foreach(Page::getStatuses() as $status=>$value) { if ($page->status & $value) $out[] = $status; } return $out; That should return an array with all statuses set for $page, right?5 points
-
Same issue as you got here https://processwire.com/talk/topic/5857-using-pages-in-custom-function/?fromsearch=1 and lostkobrakai explained there too ...3 points
-
In the admin we have an option to set a sorting for children using one field only. I have a problem with children getting sorted randomly when using a date field that is the same for multiple children. Usually we would sort by date and by ID or title, but we are only allowed to specify one field at a time. The problem with this is that once you edit one of those children, the sorting is randomly changed (actually everytime you edit a children) That's not really nice and very confusing. I had to use a dirty hook to change the children sorting one parent manually. $this->addHookBefore("ProcessPageList::find", $this, "sortingChildren"); public function sortingChildren(HookEvent $event){ $sel = $event->arguments("selectorString"); $page = $event->arguments("page"); if($page->template == "news-category"){ $event->setArgument("selectorString", $sel . ",sort=-datetime, sort=-id"); } } Maybe there's already a way I don't know or a module? But then I think this should be in core of course and not a module. Thanks.2 points
-
For process locking you could take a look at LazyCron. Integrating the ProcessWire logging api shouldn't be much of a hassle (http://processwire.com/api/variables/log/). You can just create a own log file and use it.2 points
-
Quote from the docs See: https://processwire.com/api/modules/markup-pager-nav/2 points
-
https://processwire.com/talk/topic/2458-module-fieldtypeconcatenate/ Fast LostKobrakai2 points
-
2 points
-
This is freaking cool, keep up good work2 points
-
I see that you just upped the version number in the modules directory for this module, as well as your TextformatterImageLinkInterceptor module, both to 0.1 The problem is that in Github, they are both still showing: 'version' => 1 which translates to 0.0.1 This is causing problems for PW sites when you click "Check for Updates" or you use the ProcessWire Upgrades module because they both say there is an update (because they pull from the modules directory), but then they get the files from Github which are still versioned as 0.0.1 The best option is to set the version in the file on github and then run the "Edit this Module" option in the modules directory and just submit to have it grab the new version number directly from the file - this way they will always be in sync and will prevent any issues. Thanks!2 points
-
I suggest you carefully study and bookmark/reference this table. It is an invaluable reference that will teach/remind you when to use/not use isset, empty, is_null, etc.. PHP type comparison tables http://php.net/manual/en/types.comparisons.php As for you image, I think I already answered you question but I'll repeat it here: If it is a single image field [an image field with a maximum files allowed of 1] if($page-img) {} if it is a multiple image field [an image filed with maximum files allowed of 0 or > 1, even if it contains only one image in your page] if(count($page->img)){}2 points
-
Hi All, I am gladly posting my first site profile. Blue-VR Site Profile for ProcessWire Summary A site profile for corporate or personal website. Profile can be used with ProcessWire open source CMS/CMF version 2.3+. The front-end uses the Bootstrap 3.1 css framework for to get the responsiveness and mobile friendliness. Front-end Demo - bluevr.webcreate.lk Back-end Demo mode - bluevr-webcreate.lk/processwire (The username 'admin' and password 'bluevr2') Overall features * HTML5 & CSS3 + ({less}) * Build with bootstrap 3.1 * SEO Friendly * Clean & modern design * Responsive markup * Contact form and google map locations with multiple google markers * Testimonials using bxSlider * AIOM supports (Just install the module no need to touch the code) How to install Please take a copy of the latest ProcessWire (Replace the install, modules and templates directories with those in this profile, as shown below: - /site-default/install/ - /site-default/modules/ - /site-default/templates/ Make sure you do following steps as well 1. Add `tinymce` directory into /site-defaut. 2. Add the following two lines to your `/site/config.php` file: $config->prependTemplateFile = '_init.php'; $config->appendTemplateFile = '_main.php'; Download Github: https://github.com/gayanvirajith/BlueVrSiteProfile/ Credits I would like to thanks Ryan for giving us great CMS/CMF and modules. Hani AbuGhazaleh for a great module of Fieldtype: Select (AKA Drop Down) David Karich for providing such a nice module AIOM+. *** Please note that the site profile is still on testing stage. Thanks ------------------------------------------------------------------------ Edit: install instructions. Edit: Add credits Edit: Update live demo url Edit: Update back-end demo mode details1 point
-
The problem was a database timeout. I fixed the timout problem by using the following to reconnect if needed. $data = $backup->run($web); //force reconnect if database has been lost due to long job runtime try { $this->setJobData($id, $data); } catch (Exception $e) { $this->modules->wire('database')->closeConnection(); $this->setJobData($id, $data); } Not the most beautiful solution. I would prefer to have a $db->ping() method as there was with mysqli. Maybe that would be a good extension to the DBO? I created a pull request: https://github.com/ryancramerdesign/ProcessWire/pull/1097 Its not dead important but I think it would be nice.1 point
-
Not direct, sorry. But this can be a starting point? http://php.net/manual/de/errorfunc.constants.php#1094301 point
-
max_execution_time is set (by calling set_time_limit() - it probably only works if the php setup allows so - ill have to check). You can set that in the admin:) The Script runs until it is nearly finished. Then I want to save the result (info the job was successful and the log) to the database. So its probably what you call a "summary". So maybe this is a seperate database timeout? Does processwire open a mysql connection for every request? Maybe that connection just dies after some minutes of doing nothing. There can always be more Like e.g. class based loggin in a LOG4J style. But more is not always better. At the moment I don't log to files by default (which might be a bad Idea considering the database timeouts...) but I used to log to an own log file.1 point
-
Take a look at this topic, and particularly Soma's answer there. The question mark means that ProcessWire doesn't yet know which page was requested. Either your site is getting more traffic than the (MySQL) server can handle, or there's something else going wrong. Might be worthwhile to take a closer look at Apache logs if you want to find out what exactly is going on traffic-wise. Additionally checking MySQL slow queries log (if you've got that enabled and can access it) could provide some sort of insight1 point
-
The api variables are only available in the template scope. They aren't global in any way. As soon as you're creating a function you create a new scope, therefore the variable is not accessible anymore. That's the reason for the above posted ways to access the api.1 point
-
1 point
-
In functions, use wire('user')->languageor, in case of module files: $this->wire('user')->language1 point
-
InputfieldWrapper::render is quite a beast of a function. Either you try to edit the markup strings of $defaultMarkup or if that isn't enough for your case it's most likely the easiest to modify the markup after the function is done.1 point
-
You're looking for the wrong render function. Inputfield::render is the abstract function that every inputfields overwrites with it's own. What you're looking for is InputfieldWrapper::render.1 point
-
Even though you're using "limit=1" the find() method should still return a PageArray. So you need to use "first()" on it before getting the thumbnail field. Alternatively use get() to only get the first item, which wouldn't need the "limit=1" selector. Also sorting by id might work, but actually "modified" or "created" are more descriptive.1 point
-
i copied an older version of .htaccess file to the .htaccess on the server. i got the admin login page! but it says: Not urgent, but note that your root .htaccess file is not up-to-date with this ProcessWire version - please update it when possible. To ignore this warning, replace or add the following in the top of your existing .htaccess file: # @indexVersion 250 could someone provide me with an uptodate version of the .htaccess file? thank you!!! *okay! so i will copy your file into the .htaccess, Marcus! *Solved! Thank you, Marcus!1 point
-
// $images is a array of images, therefore first you need to get a single image $images = $child->gallery_preview_image; // Select an image out of the array $image = $images->first(); $image = $images->eq($n); $image = $images->last(); // Each image has properties and methods. With some methods you can manipulate the image // $thumb isn't different to $image besides it's pointing to another file $thumb = $image->size(600, 400); $thumb = $image->width(300); $thumb = $image->height(100); $thumb2 = $thumb->width(50); // properties work for all images $url = $image->url; $url = $thumb->url; You can chain all those commands, I just split them for the explanation.1 point
-
1 point
-
So, basically, Arvixe has broken everyone's sites? Since when can they just alter everyone's files? Phew, I'm so glad my hosting provider knows what they're doing... Sorry, just had to get it out there...1 point
-
yes, and in that file there is only one row: AddHandler application/x-httpd-php54 .php54 .php maybe, they deleted something or everything in this file? i never played with these kinds of advanced issues before.1 point
-
Good job Blad, glad to see you back. Off the record, in Spain lot's of Norwegians and Russians are looking for a House to buy. If you join forces with a real estate or work as an intermediate commissions on a sale vary between 2 and 5 % which can be quite profitable.1 point
-
Nice to see what you've been up to blad - you've been very quiet lately - now we know why. Nice job - looks like a great custom admin interface you've built! Is this a bug: http://www.grupoolmos.com/inmobiliaria/piso-bien-amueblado-en-armilla/ Looks like there is something wrong with that thumbnail slider's container width. I am on Chrome / OSX1 point
-
When you have a field that is returning an array, like an images field that allows more than 1 file, you want this: if(count($page->img)) {1 point
-
1 point
-
Yep - speedier site setup for sure! Also, with the new batch update function, it is also much easier to update all the modules on existing sites in one go. I find it can be quite tedious to update modules one by one with the current PW tools.1 point
-
I like the current behavior in that you can save a page unpublished and the populated fields will be saved. Even if you try to publish, the populated fields will be saved, it's just that it won't actually publish until the required fields have been populated. But I would like the option to not show the required warnings unless the user is actually trying to publish the page. On templates with long complicated sets of fields, there are plenty of times you don't want to fill out everything right away and I think the warnings are intrusive at this point. I am thinking this would be a template level setting, but I guess it could also be per field, but that might be a little annoying to set them all? If it was per field, then it should be available as a template context override as well. Of course the title field should be treated differently. Anyone else have any thoughts on this?1 point
-
You should be able to do this on your own. Use $config->prependTemplateFile = '_init.php'; in your config.php and try this: // _init.php // Alter from basic-page.php to basic-page-dev.php if($user->isSuperuser()){ $page->template->altFilename($page->template->name."-dev"); }1 point
-
Hi everyone, Just added some new features (not in the repo just yet), but wanted to get some feedback on a new name for the module. It still functions as a way to migrate modules and their settings from one PW install to another, but now also includes: batch download and install modules from a list of class names entered in a textarea field batch module updating Name ideas: ModulesManager wouldn't be bad, but already taken ModulesMigratorInstallerUpdater would be the most accurate, but obviously ugly ModulesInstaller is OK, but doesn't cover everything ModulesHelper ? ModulesToolkit ? Free like for any suggestions Here are some screenshots for inspiration: THE OPTIONS EXPORTING INSTALLING (FROM MIGRATED ZIP) INSTALLING (FROM LIST OF CLASSNAMES) BATCH UPDATING MODULES WITH AVAILABLE UPDATES1 point
-
Hey marcus, all, Is there anyone played with the importing / exporting of the fields and templates via json and keeping them on the module. May be we can make that a wireshell command . I was looking at continuous integration of fields and templates.1 point
-
Not hard at all - fun, as I'm dealing with amazing tools (ProcessWire, Symfony, Composer packages) and learn a lot on the way1 point
-
Hi everybody, First of all: Thanks to everybody for keeping the community alive. Every time I search for something in the forum I find the solution. Great work! I wanted to share a small module with you / my first one. I use it in order to switch the user language on page load. Processwire GeoInfo GeoInfo is a small module that Implements Geoplugin PHP web service. Please donate to "geoplugin.com" in order to keep the service alive. The Module ads two methods to retrieve data from the web service. $page->GeoInfoIP('IP ADDRESS'); you can enter the ip address manually. If left blank the server remote address will be used. The retrieved data is then stored to the active session, in order to limit the requests. The web service gives back following data. 'geoplugin_request' 'geoplugin_status' 'geoplugin_credit' 'geoplugin_city' 'geoplugin_region' 'geoplugin_areaCode' 'geoplugin_dmaCode' 'geoplugin_countryCode' 'geoplugin_countryName' 'geoplugin_continentCode' 'geoplugin_latitude' 'geoplugin_longitude' 'geoplugin_regionCode' 'geoplugin_regionName' 'geoplugin_currencyCode' 'geoplugin_currencySymbol' 'geoplugin_currencySymbol_UTF8' 'geoplugin_currencyConverter' for e.g. $page->GeoInfoIP('IP ADDRESS')->geoplugin_countryCode; will give back the country iso code. $page->GeoInfoLatLong('LAT', 'LONG'); Enter Latitude and Longitude in order to get following information: 'geoplugin_place' 'geoplugin_countryCode' 'geoplugin_region' 'geoplugin_regionAbbreviated' 'geoplugin_latitude' 'geoplugin_longitude' 'geoplugin_distanceMiles' 'geoplugin_distanceKilometers' for e.g. $page->GeoInfoLatLong('40.712784', '-74.005941'); will give back the city name "New York City". Todo store places in json file / check if place exists implement nearby "service" https://bitbucket.org/pmichaelis/processwire-geoinfo1 point
-
I'm interested learning more, do you have specs? Here's something I'm working on now, it showcases my skills w/ PW.1 point
-
@Nico, been meaning to ask you if we could have your template editor check for this module installed and then have a setting or something to use ace extended for template editing; i'm actually already using this with your template editor, but i hacked your module hardcoded to use this inputfield1 point
-
At this point it's a bit like asking to drop php in favor of go. PW is a php/(my)sql framework by nature, and that's what it will continue to be. I would love to see other projects assumidely inspired by pw but built in other systems popping up.1 point
-
It's not only the same error in the log, but you're also doing the same thing wrong. You can't use $pages in functions because of variable scope. ProcessWire makes these object automatically available for the scope of the templatefiles, but inside a function is a new scope, so you need to either redefine the variable itself or use a function to get the object. // Template scope $id = 15; // simple variable, defined by you $pages = $pages; // the pages object, defined automatically by processwire function something(){ // this is now a new variable scope // neither $pages nor $id are available here. // the api variables are not a special global variable $pages = wire('pages'); $pages->find(""); // OR just wire('pages')->find(""); } It's the same reason, why you can't use $pages in modules. $page/$pages and the other variables are just convenient to use in templates. Everywhere else you need to call them differently.1 point
-
Edit: Here's some code. Note, I am using a URL field...works fine... if ($page->links) { echo "<p>The existing short url is :" . $page->links . "</p>"; } else { require_once('Googl.class.php'); $url = new GoogleURL('YOUR_API_KEY'); // Shorten URL $shortUrl = $url->shorten($config->httpHost . $page->url); $page->of(false); $page->links = $shortUrl;//this is a URL field $page->save('links');//we save only this field (see Adrian's post below) echo "<p>The shortened url is :" . $page->links . "<p>"; }1 point
-
I'm not sure what login you mean but for custom login using $session->login(user,password) you'd have to code it like this: //.. try{ $u = $session->login($username, $pass); if($u && $u->id){ $session->redirect("/somepage/"); } } catch(Exception $e) { echo $e->getMessage(); }1 point
-
Not the ideal way to debug like this code in a forum. Nothing against anyone personally. Now the code lost intendation and no way to go through it. Please post code to some snippet site like Gist or bitbucket. In general, we should provide some more practice and best ways HOW TO DEBUG YOUR CODE. Good coding is learning how to debug. There's simple steps you can go through to test all vars and parts of code to see where the problem lays. Sometimes it's simple sometimes it can get hard, as you when you don't have errors. Ok. What I spotted too is the last bit, where is the $u->getErrors() coming from? Also as you say the page isn't created at all? I would start there and get that right first and work you way up. Thanks, Soma1 point