
theo
Members-
Posts
299 -
Joined
-
Last visited
-
Days Won
1
Everything posted by theo
-
@interrobang Yes! bodyClass: Inputfield_textarea1 Is exactly what I was looking for. Thank you!
-
@kongondo Perfect, thank you!
-
Hello I think my "editors" should not see the 404 page in the list (backend). I guess this page should not be deleted for technical reasons. Is this right? If so, what is the best way to hide it? I have written a little module (code below) and this seems to do what I want. But is it a good way? Is there anything I have overlooked? Or is this overkill and there is a much simpler way? Thank you. <?php namespace ProcessWire; class HideAdminPages extends WireData implements Module { public static function getModuleInfo() { return array( 'title' => 'HideAdminPages', 'author' => 'Theo', 'version' => 1, 'singular' => true, 'autoload' => true ); } public function init() { if (!$this->user->hasRole('editorrole')) return; //hide for editorrole only $this->addHookAfter('ProcessPageList::find', $this, 'pageListFind'); } public function pageListFind(HookEvent $event){ $pages = $event->return; if($this->config->ajax){ foreach($pages as $p) { if($p->id == 27) $pages->remove($p); //27 is the 404 Page } $event->return = $pages; } } }
-
@szabesz I will try this tomorrow. I remember I've used this method before for a PageTableExtended and it worked. Should work with CKEditor too. Thank you.
-
Yes, thank you. My question was, if I can share the file and still have some different CSS rules for different CKEditors. But it is not a big problem if it is not possible. I will take a different CSS file for each editor then. ¡Gracias!
-
Thank you. Can you please explain?
-
Hello Is there a way to share an editor.css for several CKEditor fields and make a difference for each? (talking about backend only) I tried sth like this: .Inputfield_textarea1 h1 { text-transform:uppercase; } Meaning I want to uppercase h1 only for textarea1. But this doesn't work. I know I can write a separate css file for each CKEditor, but it would be easier this way. Thank you.
-
I think the easiest would be to change the way the navigation is created, so that you can filter out the pages with a "dev" tag for the production site.
-
I wrote some code for BS4 Nav this morning for myself. Maybe it helps. If it is not 100% what you need, it should be very easy to change the code in echoBS4Nav and echoBS4children. Use like this: <nav class="navbar etc..... <div class="collapse navbar-collapse" id="navbarsExampleDefault"> <?php require_once 'turbopw.php'; $myTurbo = new ProcessWire\TurboPW($wire); $myTurbo->echoBS4Nav("id!=1,has_parent!=2", '../'); ?> </div> http://theowp.bplaced.net/upload/turbopw.zip Attention, the code is very fresh! And it is not as comfortable as MenuBuilder or MSN. Just sharing. The rest of the code in this file has to do with the thread below. Don't worry.
-
In my opinion, Processwire is mainly a tool for coders to develop back ends for their (noob) customers. So developing the "behind-the-scenes view" is a part of the job, as well as creating the front end. It has not much to do with your front end HTML, CSS, other than that it does not prevent you from doing what you want.
-
@kongondo Does ryan usually read the forum, when you call him with @?
-
@alxndre Sure it is not really a problem, once you know how it works. For my case this does what I want: $pages->find("id!=1,has_parent!=2"); Meaning: all, except home and everything under admin (For logged in admins). But still, such little uncertainties can diminish confidence in the system.
-
Hello Can anybody explain, why the result of the selector "has_parent=1" includes 'home'? $homes=$pages->findIDs("has_parent=1"); echo $pages->get($homes[0])->name; //returns 'home' I would expect that 'home' is not a parent of itself. Thank you.
-
@Zeka: Never mind. It's working when I add new items now. This is probably an artifact from an older PW version I was using to create these items or some changes to language settings afterwards. Thank you! Problem solved.
-
@Zeka Thank you! Very good point. On the page, these languages are allowed. That's why it returns the first repeater item! But looking at the database for these repeater items, I can see sth. is strange: You see only the first of the 4 Items in this repeater has: status1012=1, the other have 0. But why? Thanks to your answer I'm getting closer... Btw: it has nothing to do with findIDs etc. The problem is the same with: $this->pages->find('parent=3001'); Now we know why, but not how it came to this.
-
Hello I have this simple code: $pages = $this->pages->findIDs('id=3002|3003|3006|3007'); var_dump($pages); The ids in the selector belong all to items inside a repeater! It know that the example doesn't make a lot of sense, but it is reducing the problem to the essential. If I run this code with the default language url, like myhome/export/, it shows what I would expect: array(4) { [0]=> int(3002) [1]=> int(3003) [2]=> int(3006) [3]=> int(3007) } If I run the same page with a non standard language url, like myhome/de/export/, it shows: array(1) { [0]=> int(3002) } What could be the reason for this? Shall I write a bug report?
-
I think Duplicator is an easy way to do this. It worked here.
-
It's about the first experience. Nobody RTFM before installing. Probably the Installer should warn before renaming the htaccess.txt, because afterwards it's dead and silent.
-
Sure, but it is a really bad "first experience". That's why I wonder if there aren't any more compatible standard settings.
-
I don't think this locale problem is that important. But there is another thing: The default .htaccess file almost always (remote or local) throws a "500 Internal Server Error" here during installation. This can be discouraging for newbies. I always have to uncomment: # Options -Indexes # Options +FollowSymLinks # Options +SymLinksifOwnerMatch Wouldn't there be less problematic standard settings? 500 is really a nasty message, as it gives you no hint about what to do.
-
Now i've had a hard time with strange results until I found out that MySQL WHERE IN () does not necessarily retain the sort order of the ids you pass it. You have to pass the ids again in an ORDER BY statement. $pagesset = implode(",", $pages); $sql .= "\nFROM\n pages AS p"; $sql .= "\nWHERE\n p.id IN (" . $pagesset . ")"; $sql .= "\nORDER BY FIELD(p.id," . $pagesset . ")"; echo '<pre>' . $sql . '</pre>'; $results = $this->database->query($sql); $event->return = $results->fetchAll($type);
-
Thank you. I have never used it, but I think the best idea is, to be efficient on all levels. Create the tree fast using findArray, maybe even load parts via Ajax, and/or use caching. If creation is as fast as shown in the example (794 Titles in 0.021 seconds ), Ajax and caching are probably not necessary.
-
Because if you need foolproof, there is the Processwire API. This is about speed and foolproof <> speed! I think it is sometimes enough to show the way (As you and adrian did here). Others can then change the code to fit their requirements. If you implement 1000 options, then I'm sure someone will need option number 1001. Yes, and with the fast multi level navigation above. Thank you.
-
It is easy to make it "all purpose" with the code above. Just change it to return all the requested values (foreach): case $fieldtype instanceof FieldtypeImage: $sql .= ",\n (SELECT GROUP_CONCAT($data SEPARATOR 0x1D) FROM field_$f WHERE pages_id = p.id) AS $f"; foreach ($field_extra as $exfld) $sql .= ",\n (SELECT GROUP_CONCAT($exfld SEPARATOR 0x1D) FROM field_$f WHERE pages_id = p.id) AS " . $f . "_".$exfld; break; Query like this: foreach ($pages->findArray("id=1, sort=title, limit=1000", ['title', 'images:description:modified:created'], ['created']) as $p) { echo $p['created']; //Page created echo $p['images_created']; //Images created. Delimited String echo $p['images_modified']; //Images modified.Delimited String Created SQL looks like SELECT p.created, p.id, (SELECT data1012 FROM field_title WHERE pages_id = p.id) AS title, (SELECT GROUP_CONCAT(data SEPARATOR 0x1D) FROM field_images WHERE pages_id = p.id) AS images, (SELECT GROUP_CONCAT(description SEPARATOR 0x1D) FROM field_images WHERE pages_id = p.id) AS images_description, (SELECT GROUP_CONCAT(modified SEPARATOR 0x1D) FROM field_images WHERE pages_id = p.id) AS images_modified, (SELECT GROUP_CONCAT(created SEPARATOR 0x1D) FROM field_images WHERE pages_id = p.id) AS images_created FROM pages AS p WHERE p.id IN (1) Not sure if array or delimited makes a difference. I don't think this is ever going to be a foolproof tool, but it's great base which you can extend to your taste. For my purpose (Exporting data to CSV fast) it's almost ready.
-
I've reported a similar problem here: I'd prefer if PW would fill in something automatically here instead of throwing error messages.