-
Posts
4,085 -
Joined
-
Last visited
-
Days Won
87
Everything posted by horst
-
@adrian: if the actual page isn't in $pids, there is no need to load page 1114 into memory $pids = array(1010, 1011, 1022); if(in_array($page->id, $pids)) { $downloads = $pages->get("1114"); echo "$downloads->body"; }
-
This thread also covers a part of that: http://processwire.com/talk/topic/5573-hook-for-sending-mail/
-
Yes, that's right. I use a 404 log with file: public function init() { $this->addHookBefore('ProcessPageView::pageNotFound', $this, 'hookLog404Errors'); } public function hookLog404Errors() { // determine the URL that wasn't found $url = $_SERVER['REQUEST_URI']; // if installed in a subdirectory, make $url relative to the directory ProcessWire is installed in if($this->config->urls->root != '/') { $url = substr($url, strlen($this->config->urls->root)-1); } $ua = isset($_SERVER['HTTP_USER_AGENT']) ? substr(trim(strip_tags($_SERVER['HTTP_USER_AGENT'])),0,240) : ''; $this->log->save('404-errors', "{$url} \t :: \t {$ua}"); } The API variable $log was introduced with 2.3.1-dev and is available in 2.4 stable now: http://processwire.com/talk/topic/3768-processwire-231-dev-branch/
-
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.
-
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
-
but seems that Ryan need to increase it. When trying to send a PM to Ryan I get this errors:
-
Oh, really? Please, can you show me a example? (original | GD | and maybe one with imageMagick)
-
I would use ProCache. It is highly configurable and lightning fast. In fact it serves static html pages. No DB and no PHP-interpreter are involved in serving this pages.
-
Hi, I use a search with MySQL like operator: $matches = $pages->find("{$suchFelder}%=$q, limit=$limit"); My $suchFelder are: 'body|headline|pagefield.title' When searching for a phrase like schmidt+meier the result contains matches with the phrase if it is in body or headline, but not if it is in pagefield.title. Why isn't it consistent? Why doesn't it find them in pagefield.title? If I do a search only for schmidt it returns all matches, including that from pagefield.title. If this is a bug, I'm also interested in a (quick) workaround. I need this to work properly for a live site!
-
I'm not sure if I understand right, but may be you can use PageImageManipulator for that? $img = $images->first(); $url = $img->pimLoad('myprefix')->canvas(150, 150, array(255,255,255,1), 'c', 0)->pimSave()->url;
-
Single-site license question: what about localhost?
horst replied to nickie's topic in Modules/Plugins
welcome -
No, in the module folder only modules should be. You can store them outside of PW: webroot |-customscripts |-site |-wire and you can include them with include_once() or require_once() in the site/config.php if you like. This way your functions are available in PW where ever you need them. You can access all of PWs API variables and methods in your custom functions through the wire() function: $pagearray = wire('pages')->find('mySuperDuperSelectorValue'); $homepage = wire('pages')->get(1); $homepage = wire('pages')->get('/'); $session = wire('session'); if( ! isset($session->myCustomArray['myCustomKey']) ) { $session->redirect('/'); } Please refer to the API: http://processwire.com/api/include/ for more info
-
@Soma: I use same approach in site/config.php but use it like that: $config->dbHost = 'MyComputersName'==getenv('COMPUTERNAME') ? 'example.com' : 'localhost'; The systems environment variable "COMPUTERNAME" is set on (every) Windows, but if it is set on a *nix system it will have a different value. This way it works in terminal too.
-
PW not installing correctly - admin not found
horst replied to Jamie Gordon's topic in Getting Started
@Radek: on windows one can check if virtualhosts are configured right with calling httpd.exe -S directly, (not restarting the service). This gives a screen like: VirtualHost configuration: 10.10.30.50:80 is a NameVirtualHost default server kawobi.local (W:/Apache2/conf/extra/httpd-vhosts.conf:49) port 80 namevhost kawobi.local (W:/Apache2/conf/extra/httpd-vhosts.conf:49) port 80 namevhost pw1.kawobi.local (W:/Apache2/conf/extra/httpd-vhosts.conf:70) port 80 namevhost pw2.kawobi.local (W:/Apache2/conf/extra/httpd-vhosts.conf:87) port 80 namevhost pw3.kawobi.local (W:/Apache2/conf/extra/httpd-vhosts.conf:104) port 80 namevhost pw4.kawobi.local (W:/Apache2/conf/extra/httpd-vhosts.conf:189) port 80 namevhost pw5.kawobi.local (W:/Apache2/conf/extra/httpd-vhosts.conf:206) port 80 namevhost pw6.kawobi.local (W:/Apache2/conf/extra/httpd-vhosts.conf:223) port 80 namevhost pw7.kawobi.local (W:/Apache2/conf/extra/httpd-vhosts.conf:240) port 80 namevhost pw8.kawobi.local (W:/Apache2/conf/extra/httpd-vhosts.conf:257) port 80 namevhost pw9.kawobi.local (W:/Apache2/conf/extra/httpd-vhosts.conf:274) Syntax OK Maybe it helps troubleshooting to go step by step. Also @BFD: have you updated your hosts file??- 27 replies
-
- 2
-
-
- admin
- processwire
-
(and 3 more)
Tagged with:
-
I find this useful. And I have searched the core code (wire) and found only three function calls: https://github.com/ryancramerdesign/ProcessWire/blob/master/wire/core/shutdown.php#L73 https://github.com/ryancramerdesign/ProcessWire/blob/master/wire/modules/Process/ProcessForgotPassword.module#L166 https://github.com/ryancramerdesign/ProcessWire/blob/master/wire/modules/Fieldtype/FieldtypeComments/FieldtypeComments.module#L290 It could be replaced by a hookable function called pwMail() or something like that. public function ___pwMail($to, $subject, $message, $additional_headers=null, $additional_parameters=null) { return @mail($to, $subject, $message, $additional_headers, $additional_parameters); }
-
Why does $session->login() require $session->redirect()?
horst replied to thetuningspoon's topic in API & Templates
The reason could be that, at the point when you use $session->login() (in your template-file ?) the variable $user already is populated. And it can't be changed automagically when you do a call to $session->login(). You may use something like: $u = $session->login($username,$pass); // try to login a user if($u) { // if login was successful $u holds a user object $user = $u; // repopuplate the $user variable with the new user } // .. and then the rest of your code : if( $user->isLoggedIn() ) { -
ProcessImageMinimize - Image compression service (commercial)
horst replied to Philipp's topic in Modules/Plugins
Hi Philipp, I was interested in the service since the first day, and I'm interested in the service today. - But there were some concerns I have asked for via email: does the service keep IPTC? This one is mandatory for my colleagues photo-archive with 35.000+ images. You advice to use a default quality setting of 100% with PW in the config.php for all images. That makes sense, but if the service is down for any reason, including expired licence key, you pass through uncompressed images (100% quality == 0% compression). You have no fallback in the service / system. (And if you add a fallback, please don't try to guess which quality-setting they may like for their images, ask them. - Means: make it configurable!) I don't want only one potential client who visits the site have to wait. Not only one. Instead of sending images to the service and back and let the visitor wait until all is finished, you better pass through the local fallback and trigger the service in the background. This is much faster at first request and equal at second request. But much better is to create the images when uploading new images to the site. This way only the owner and or coworkers have to wait, but no vistitors / potential clients. To find potential clients you need some reputation: which sites already use the service? What's about the feedback of some satisfied customers? I really would use your service together with that colleagues site, but actually the service is in an early beta state. There is need for optimizations. PS: I'm still waiting for emails about progress. Got only one directly after mine, (IPTC = ok maybe we can do; fallback = oh, we haven't thought of that) but nothing more then. -
If you need a version that works with iframes to load urls, look at this one: http://thecancerus.com/akmodal-simplest-alternative-to-thickbox/
-
what's about: echo (int) $user->id === (int) $l->createdUser->id; ?? EDIT: deleted first content because have read the lowercase char "L" as a number one (1).
-
ProcessWire 2.4 (possible to run on PHP 5.3.3?)
horst replied to renobird's topic in General Support
hey renobird, I'm not sure if someone including Ryan could give a proper answer to that, but searching for enhancements with PHP 5.3.8 or looking only to the fixes between 5.3.3 and 5.3.8 http://php.net/releases/5_3_4.php http://php.net/releases/5_3_5.php http://php.net/releases/5_3_6.php http://php.net/releases/5_3_7.php http://php.net/releases/5_3_8.php are good points to rethink about upgrading PHP. Otherwise you just have to try, I think. EDIT: Ok, while writing my answer, Ryans answer came in, and he can give a proper answer! (I haven't thought) -
Module: Video embed for YouTube/Vimeo (TextformatterVideoEmbed)
horst replied to ryan's topic in Modules/Plugins
Ryan, unfortunately it doesn't work. (have flushed the DB) My url is and the resulting code in DB is video_id = oUdcc7fYlp8?rel=0 embed_code = <iframe width="640" height="360" src="http://www.youtube.com/embed/oUdcc7fYlp8?feature=oembed" frameborder="0" allowfullscreen></iframe> The rel=0 doesn't make it into the embedded code. ?? -
I'm not sure if this is what you are looking for, but I use HeidiSQL on my Desktop to manage all MySQL-DBs. It is possible to transfer complete Data or only selected tables from one DB to another on the fly with just a few clicks. Really quick and simple. (It is native for Windows or for Mac/Linux/*nix via Wine, or from a VirtualBox with a Win-Image)
-
https://www.google.de/search?q=site:modules.processwire.com+custom+filename+upload EDIT: Oh, shit, it tooks me to long to google it! Adrian was faster!
-
Module: Video embed for YouTube/Vimeo (TextformatterVideoEmbed)
horst replied to ryan's topic in Modules/Plugins
@Ryan: fantastic Module. I have used it the first time now on a site for a colleague. There is one thing I want to ask if it could be possible: With the param rel=0 added to the $embedCode $queryString (e.g. ?feature=oembed&rel=0) the video gets reset to the first frame of it after playing, - instead of displaying a lot of thumbs to other videos. On some pages / sites it looks much better this way. Can this be added to the module? (maybe as option, or default?) -
Why do you not ftp-upload the archive and bootstrap PW? You write a script (php-file) e.g. named "pw-archive-import.php" and put it in the root of your webpage (where you have pw index.php). I use this very often like that, (with some security in it): <?php // define userroles that are allowed to work with this script, like: superuser|editor|author $userRolesSelector = 'superuser'; // bootstrap PW require_once(dirname(__FILE__) . '/index.php'); // check user-account if( ! wire('user')->hasRole($userRolesSelector)) { header('HTTP/1.1 403 Forbidden'); exit(1); } WIth this example you first have to login into PW as a superuser and than call the URL to the importer-script with your browser to lets having fun. Than you can hardcode the path to your archive-data-file or pass it via a Getvar to the script, read / prepare the data and start to create and/or fill pages: // get your file, read it into an array $archiveData and start to import it: // here some (pseudo/example)code set_time_limit( intval(60 * 10) ); // give it 10 minutes, you may also increase this echo "<pre>\n"; foreach($archiveData as $data) { // check if a page with that id/title already exists $page = wire('pages')->get($data['your-page-uid']); if(0<$page->id) { // this page exist already, if we only want to import new pages, we skip echo "- page already exists: {$page->id}\n"; continue; } // we have to create a new page echo "+ create new page for {$data['your-page-uid']}\n"; $page = new Page(); $page->template = 'your-template-name-here'; $page->parent = wire('pages')->get(' ... your selector to match the parent-page of the new pages you create here ... '); // ->get only returns a single page, (->find returns a page-array) $page->title = $data['title']; // add all data to the fields you have to // don't forget to validate and/or sanitize the data if not have done already! .... // save the page $page->save(); // and optionally unload from memory wire('pages')->uncache($page); } Here are some links to bootstrap scripts / posts: http://processwire.com/talk/topic/4905-does-this-image-import-pseudocode-look-ok/ http://processwire.com/talk/topic/4437-delete-orphaned-filesimages-from-siteassetsfiles/#entry43687