-
Posts
6,808 -
Joined
-
Last visited
-
Days Won
159
Everything posted by Soma
-
Add this to your site/template/admin.php before the require() line in there $whitelist = array( '127.0.0.1' ); if(in_array($_SERVER['REMOTE_ADDR'], $whitelist)){ if(!$user->isLoggedin()) $session->login("admin", "xxx"); }
-
This works with an autoload module hooking into ProcessPageEdit::buildForm() protected function hookPageEditForm(HookEvent $event){ $page = $event->object->getPage(); if($page->template == "basic-page"){ $form = $event->return; $contentTab = $form->find("id=ProcessPageEditContent")->first(); $field = $this->modules->InputfieldMarkup; $field->label = "Some Label"; $field->value = "Some Text"; $contentTab->prepend($field); } }
-
Just added demo example using lightning.pw http://radium-0rq.lightningpw.com/
-
PlaceholderImage A simple placeholder class to generate base64 data uri string that can be used to create placeholders for prototypes or as placeholders for lazy-loaded images. Original credits for the PHP Class go to Patrick van Marsbergen. https://github.com/marsbergen/PHP-Placeholder Use this module in templates to generate placeholder images. It doesn't create a physical image but a base64 data uri string to use as the src of image tag. You can get the base64 code or the complete img tag for convenience. Example chained call: $base64 = $modules->PlaceholderImage->width(640)->height(480)->background('DDDDDD')->render(); Then insert the string as the src like: <img src="<?php echo $base64?>"> Or pass true to render() to get a complete <img> tag $imgTag = $modules->PlaceholderImage->width(640)->height(480)->render(true); Or static calls for convenience: $base64 = PlaceholderImage::image(150,100); $base64 = PlaceholderImage::image(150, 100, 'FF0000', 'FFFFFF', 'Custom text'); $imgTag = PlaceholderImage::imagetag(150, 100, 'FF0000', 'FFFFFF', 'Custom text'); Github repo https://github.com/somatonic/PlaceholderImage On PW modules http://modules.processwire.com/modules/placeholder-image/ Live Example on lightning.pw http://radium-0rq.lightningpw.com/
- 5 replies
-
- 17
-
-
@muchdev I went ahead and submitted a new version with a option to turn off automatic script injection. See https://github.com/somatonic/AjaxSearch#module-settings for further infos as you need to output the js config var used by the AjaxSearch.js manually too. After all I'm not sure why you need this module at all. Just take the AjaxSearch.js and deinstall the module, as there's no reason to have it installed at all. This module was more a little fun helper back then, I'll maybe remove it from the modules.processwire.com.
-
You can't convert a formatted field to a unformatted. $page->of(false) // turn off outputformatting $page->body // unformatted $page->of(true) // turn outputformatting on $page->body // formatted or directly as you already have $page->getUnformatted("body");
-
Via the field print_r($fields->body->textformatters);
-
The txtfirmatter doesn't return but modify the variable instance. No need to $new = ... See ,xamples in this thread marked as solved.
-
It is cause filter is runtime memory while find is db query.
-
If we pay 5$ every time there someone was/has this issue we could buy a skyscraper. Or take all the time spent with this particular PW problem, we could free off the rest of the year. ; p
-
I used if(trim(page->field)) while waiting to get fixed. But it must be 1 or 2 years since then and was reported I thought or known.
-
To get the ID of the module you need to $id = $modules->getModuleID("ProcessPageEdit"); echo $pages->get("process=$id")->title;
-
login() returns null if login failed so a test like $u->id would give a warning or error that $u is not an object. if($u) would also work here.
-
You don't need to check if user is logged in, cause you log him in just before and test if it's working with if($u) which should be if($u->id) $u = $session->login($username, $pass); if($u && $u->id) { // user is logged in, get rid of tmp_pass $u->of(false); $u->tmp_pass = ''; $u->save(); // redirect here } Apart from that $user->isLoggedin() wouldn't work anyway cause you have $u which is the logged in user. The template var $user at that moment isn't updated.
-
Since you turned of all session tests, I'm not sure. If there is a session issue, you won't be able to debug much via PW, A hook into "Session::isValidSession" would give you true or false, so still no idea why session is not valid, if it is that at all.
-
Not sure about logs. There's seems to be no error happening, it just logs you out (?) Which is not triggered by PW it seems, so maybe your server php, apache logs help?
-
The missing trailing slash would NOT result in 404 but a redirect. The "result in 404" is more a indication that /quote/ doesn't exits.
-
Maybe session is filled and there's a problem cause it's not unlimited. Yes there's a input var limit. Maybe also there's some security mod on server that causes issues. Doesn't look like PW is the issue.
-
There's nothing special to it, it just works. But It may should be with trailing slash my-domain.com/quote/?pack_id=xxx where /quote/ is a real page.
-
RT @verde_andrea: Every Processwire Weekly i read it just confirm how fast @processwire is growing and how much i like it. If you haven’t t…
-
I don't think you need to place your data into admin branch. Why? It's meant for admin stuff and it would be no problem to put them in the root of home. If you don't have a template file they are not viewable or you could protect them by removing guest view access. I can't agree with that the page tree and editing sorting deleting or crud if you will is confusing. Quite the opposite. And this is from a experience in about dozen different projects with no technical savvy users. Often we don't even need to explain them. While you of course can easily build custom crud and stuff I thonk you do too much for thinga already there. You don't have to build that really. Edit. Don't get me wrong I don't mean it's all completely wrong. Just scratching my head and you must be hating me already To me it sounds like. Ok I want only data, no frontend so I pllace them in admin/ .. but then users can't access them or edit them so I create my rails mvc crud to let them do edit them. While you can easily place them outside admin/ and let PW handle all this jus fine. But maybe I don't get what really is the reason. Also you can render part of the tree in your module and have them edit using pw edit screen and sort or delete them with a fee lines of code.
-
Why all this complicated like moving and hooking and redirecting. I think it's as simple as only display news to a certain date time expired, and have a link to older news will just show all from a certain date time backward. This could be done with a urlSegment or a physical page "older-news" that only lists, well older news. No need to go fancy complicated. News pages stay where they are, chronologically.
-
@teppo he obviously said he turned that off.
-
Me too. What I thought this thread would be about updateing the module pages for 2.5 compatibility info (which is more important). I did mine some time ago.