-
Posts
6,798 -
Joined
-
Last visited
-
Days Won
158
Everything posted by Soma
-
This was quix implementation and not tested throughout. But it works here on osx chrome.
-
Updated the Module to support arrow key navigation in results, and close on escape key and click outside. It's there if you wanna check it out and test. Thanks.
-
I remember someone asking fo such a feature, but the thing is it isn't an autocomplete, suggest feature but a ajax search showing results that's just a html list or whatever the developer put's inside the results. The input text autocomplete default feature in browsers have to be disabled to the ajax search to no get in conflict. You can browse the results using tab, that's the standard behavior. Also the arrow keys are used to scroll in some browsers or even all I think, it is not a real problem but have to keep in mind. Maybe I could come up with something that's cycles links in a html div, but I'm not to keen to do it. For the close, there'a a close link, and maybe I could try adding esc key support for closing. I think I'll have a look at how it could be implemented.
-
Calm down, it happens in other iframe based editor too. Annoying that Chrome didn't fix it yet.
-
Thanks onjegolders for the report. I just updated the module to also work in tabs. It had to do that the init script was executed immediately before wiretabs.
-
Haven't read that well. Ok, this is kinda hard to make it short, there's many way to archive this in different levels. Are those users public-registered users or trusted users you give explicit accounts? Just to give the most restricted, just front-end users: Create appropriate roles or permissions. Like a "frontend_editor" Role and only add page view permission. You give only guest and this new role to the users. When they login via backend they won't see anything and get redirected to front-page. Voila. In your templates and modules you check for the Role the user if($user->hasRole("frontend_editor")){ // do stuff } else { // do other stuff } Edit: To give access to only certain field to edit. Well since you only have a front-end user with no access to anything, you control it via code in template. And my examples above shows a "$ignore_fields" array you could choose to ecxlude certain fields as you create the form this is simple. But anything possible in PW. There's a module that enables per field limit access by Ryan http://modules.proce...eld-permission/ might be something to try. Don't know if it works with the form rendering method here. To restrict certain users to pages. Since need to know which pages a user has you can add a page field to the user template, so you can add pages a user can edit by editing it's profile. Then you can check in your front-end code if a page he wants to edit is in his added pages. For adding pages you'll have to have to parent page field or something. // does the page field contain the page he wants to edit? if($user->editable_pages->has($editpage)){ // do edit form stuff } Or just use one page that is the parent of a branch he can "work". Use this to redirect the user to his page and do stuff and always check if the user has the rights when you do something. /Just to give some examples
-
Not sure what in detail you need, but got some example code mainly taken from the Template Form Processor render a pages form to edit in front-end. https://gist.github.com/somatonic/5011926#file-from-php Now you need to include scripts and css needed. Note this $config stuff is only populated after you generated the form in API. In the head.inc you could include script (taken from the admin template default.php and modified a little). Also you would maybe need the inputfields.css found in the admin templates folder. This somehwhere in the <head> Moved code to gist.github.com for convenience.. https://gist.github.com/somatonic/5011926#file-head-php This will give you the basic things needed, I have not tested all fields, but file uploads and date picker or even custom color picker etc works fine.
-
Errm, look the first post to see how it's done? Or where what in detail are you missing? Without a little more from your side we aren't able to help.
-
Well, the admin is built for that purpose to add and edit pages. Every user that has a login is able to see the admin, even if he can't edit anything and if he knows the url. Although you could add hooks to check for roles to redirect out of the admin in case. I didn't say use the module but look at it how it's done, it's also done using API (as everything in PW), so you would need that same codes anyway. I don't see any problems doing your own frontend forms based on a templates fields. But depending on the fields you need, it's not as easy as simply rendering the fields with a form wrapper and you're done (for the reasons mentioned). Jquery UI, inputfields css and scripts and the $config->js would also be needed for them, and some of them would be in the $config->scripts, $config->styles when you render fields on a page. I've never tried to rebuild the backend for the frontend, and always try to use some shortcut link on the pages for them to edit or create pages using a simple link with url to the right admin screen. If I combine that with &modal=1 and fancybox modal they don't even need to go to the backend. <a class="fancybox" href="/processwire/page/edit/?id=1123&modal=1">edit page</a> <a class="fancybox" href="/processwire/page/add/?parent_id=1022&modal=1">add page</a> That's in cases sufficient to give a simple frontend editing capability with 2-3 lines of code.
-
What do you want to archive by doing this? For a public form? Or for logged in users to edit a page in the frontend? You could, but not all fields are suited for front-end, you'll have to also include all css, js and js configs for special fields like page asm selects and file uploads. An example that takes this approach (without special fields) is the http://modules.processwire.com/modules/form-template-processor/
-
Thank guys for the feedback! Very appreciated. As for the claim, it is still there on: http://processwire.com/about/
-
Prepending 'Home' instead of home page title to navigation?
Soma replied to antknight's topic in General Support
Well you could have a title field and a headline (like on basic profile) You could name the title on home "Home" which will be taken for the navigation, and the headline your other title you output on the page. That's much better than hardcoding it. -
Well you can create a template without a file, but my approach is to use the aternative template field and use "main" for all templates, as this allows me to have one main template with all the main markup, and just the content part is being included via a template file that has the name of the template in PW. This allows to put all templates in a subfolder. That's true, however I don't believe there's a BEST way. It has to be BEST way for you.
-
Don't know if you seen this thread about similar setups:
-
Well deleting the original will leave you with a problem as you already know It would be relatively easy to script a batch resize all original images and run that once over all page that has images. Use the ImageSizer class. Working example: $pa = $pages->find("template=basic-page,images.count>0"); foreach($pa as $p){ foreach($p->images as $i){ $ImageSizer = new ImageSizer($i->filename); $ImageSizer->resize(120,0); } } It will resize all the original images to 120x*. And you're done. (This particular example show how cool the on-page images are.)
- 5 replies
-
- 11
-
The only way I see to do this in a find with a selector, is to do something like this: $up_pages = $pages->find("status=unpublished"); $sel = ''; foreach($up_pages as $p){ $sel .= ",has_parent!=$p->id"; } $pa = $pages->find("template=basic-page$sel"); foreach($pa as $p){ echo "<p>page: $p->title $p->url</p>"; }
-
Why not just limit width and or height in the image field settings?
-
DOn't know why it is like this, but it seems to have to do with PW getting the previous page, as if using it in a template. In your case there's no "page". I can get it to work when I call $wire->setFuel("page",$p1); after first page rendered. echo $p1 = $wire->pages->get('/videos')->setOutputFormatting(true)->render(); $wire->setFuel("page",$p1); echo $wire->pages->get('/people')->setOutputFormatting(true)->render();
-
Not an easy one, as url isn't hookable in this case. And it also wouldn't be the right place. Since if there's no image ... $page->image will not be an object to start with. But you could make a module function that you use to output images and do your checks there and return a blank.jpg or whatever if there's no image(s). // autoload module public function init(){ // add $this->page->addHook("renderImage", $this, "renderImage"); } public function renderImage($event){ $page = $event->object(); $imagefield = $event->arguments[0]; if($page->template == "admin") return; if($page->$imagefield) return "<img src='{$page->$imagefield->url}'/>"; return "<img src='{$this->config->urls->templates}img/noimage.gif'/>"; } Then use it echo $page->renderImage("image"); Or just use an include function.php, as Ryan suggested in the other thread to do such things.
-
Rename processwire directory on current installation
Soma replied to NooseLadder's topic in Getting Started
http://processwire.c...pw-in-a-folder/ About renaming, yes simply rename the folder and you're done. -
No probs. Mine mabe too..
-
U can line up blocks in a row I'll connect the dots. Wait. I thought 2 were 5. Confusing
-
Do the pages u render have a template file?
-
Is this considered to be added soon?
-
Further if you create those "category" pages, that will make the options, somewhere in your site structure you can even use those same pages to display galleries that belong to that particular category and you don't need to create such pages. Later you could add an image or description to those pages to display. So like this /galleries/categories/master-artist/ Would be also a viewable page and list all galleries that have that category selected. It goes hand in hand and requires only minimal code at the end. Need a new option? Create a new Page there and you're done. (wow so many replies already while writing this )