Jump to content

theo

Members
  • Posts

    299
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by theo

  1. Hmm, I am making some tests. Having this code: $time_start = microtime(true); $count=0; foreach ($pages->find('template=tpl_families') as $fam) { echo '<h4>' . $fam->title . '<h4>'; foreach ($fam->children() as $model) { echo '<h5>' . $model->title . '<h5>'; foreach ($model->children() as $size) { echo '<h6>' . $size->title . '<h6>'; $count++; } } } $time_end = microtime(true); $time = $time_end - $time_start; echo 'Objects : '.$count; echo ' / Execution time : '.$time.' seconds'; Returns: Objects : 794 / Execution time : 1.4819648265839 seconds Not really fast for just echoing the titles. OK, it's only running on an i3 but should have enough memory. How can I speed it up? Or do you think this speed is OK? Thank you.
  2. @Macrura Yes, it's true. Strange, I am logged in as default language user and I want the default language value. Still I have to do this way: $eng = $page->wire->languages->get('default'); $data = array( 'title' =>$page->title->getLanguageValue($eng), 'sum' => $page->summary->getLanguageValue($eng), ); Thank you.
  3. @Macrura: Thank you, but this is not working here. As I wrote in the other thread, this shows only [object Object]. To see what is going on, I use JSON.stringify(item) and as you can see above, my values (title,sum) are empty. text, value and $order have values.
  4. As workaround for PageFieldEditLinks inside Repeaters, I've hacked this. Just place the code below in templates/admin.php. (Adjust 'my_template'). if ($page->name=='edit' && $input->get->id) { if ($pages->get($input->get->id)->template->name=='my_template') { $config->scripts->add($config->urls->siteModules . "AdminPageFieldEditLinks/AdminPageFieldEditLinks.js"); $config->styles->add($config->urls->siteModules . "AdminPageFieldEditLinks/AdminPageFieldEditLinks.css"); } } Place the above before: require($config->paths->adminTemplates . 'controller.php');
  5. @chrizz : Thank you. Another aspect: What is your experience with PW regarding data loss or problems after upgrades etc? Especially with Page References, Repeaters, Page Tables,etc. No problem? Nothing that magically disappears? This would be really bad.
  6. @Macrura Follow up from I'm doing this: $data = array( 'title' => $page->title, 'sum' => $page->summary ); return $data; '<div class="item">' + '<span style="display:block;font-size:14px;font-weight:bold;">' + JSON.stringify(item) + '</span>' + '</div>' The result is: {"title":{},"sum":{},"text":"Child page example 1","value":"1002","$order":1} So my fields are empty, but there is "text" etc.
  7. @Macrura @alxndre Thank you. This is exactly the kind of answer which I was hoping for. Some experiences from the "real life". Hoping to hear even more opinions.
  8. Thank you. Hmm, it works if the page hosting the repeater has a page reference field with editLinks enabled too. Unfortunately it does not work when it is hidden. Not sure if I understand how this works. I'am seeing only [object Object] (see screenshot). But I think anyway it is not a replacement for the type of selector I need. I have to be able to select in a page tree. A flat list does not help in this case. Thank you.
  9. Thank you. There is a problem here with https://www.instagram.com/p/BeA8p9AhA3b/ Error: Exception: SQLSTATE[22001]: String data, right truncated: 1406 Data too long for column 'embed_code' at row 1 (in /home/theo/public_html/pwdev/site/modules/VideoOrSocialPostEmbed/TextformatterVideoOrSocialPostEmbed.module line 113) #0 /home/theo/public_html/pwdev/site/modules/VideoOrSocialPostEmbed/TextformatterVideoOrSocialPostEmbed.module(113): PDOStatement->execute() #1 /home/theo/public_html/pwdev/site/modules/VideoOrSocialPostEmbed/TextformatterVideoOrSocialPostEmbed.module(337): TextformatterVideoOrSocialPostEmbed->getEmbedCode('://api.instagra...', 'ig-BeA8p9AhA3b') #2 /home/theo/public_html/pwdev/site/modules/VideoOrSocialPostEmbed/TextformatterVideoOrSocialPostEmbed.module(152): TextformatterVideoOrSocialPostEmbed->embedInstagram('<p>https://www....') #3 /home/theo/public_html/pwdev/wire/core/Textformatter.php(60): TextformatterVideoOrSocialPostEmbed->format('<p>https://www....
  10. Unfortunately this doesn't work inside a repeater. I read this https://github.com/thetuningspoon/AdminPageFieldEditLinks/issues/5 But I don't really understand. Is there any update to this or an alternative? Thank you.
  11. Hello I would like to get some opinions of you about the pros and cons of migrating a MySQL Database to PW Pages. If there is already such a thread, please redirect me. Think of the skyscraper demo but bigger. ;-) http://demo.processwire.com/ A data administration tool with hierarchies of objects and persons and news etc. and everything is somehow linked together. This MySQL Database exists and I ask myself, if I should write a new "admin" backend for it (using the existing DB-Schema), or import everything as PW Pages. I can Imagine the following: PRO PW Pages - Creating the "admin" backend with PW is easier than writing an "admin" from scratch. With Repeaters and the Page Fieldtype it should be possible to link things together. Tools for Image/File upload, CKEditors etc are already there. - Querying the data for the frontend should be easy. - Everything has the same look, object- and persons administration as well as more webpage centric pages (home / about..). CONTRA PW Pages - More bloated database. Many field types. Probably slower. - A kind of vendor-lock-in. If in a few years you would like to move away from PW, exporting the whole thing including relations back to MySQL is possible but a lot of work. What do you think? What would you do? Do you think of a third way? I'm looking forward to read your opinions.
  12. Hello, What is the purpose of this module?
  13. I know this sounds a little weird, but I'll show you what I mean. I have now integrated Bootstrap 4.0.0 in the backend with PageTableExtended. This works rather well. Here you see Bootstrap 4 cards in the PW backend: To make some changes here, the editor can click on the edit icon and the pagetable / repeater opens. (The editor can define to some degree the width of each card here. ;-) ) This is all working well. Since I can edit the fields in the frontend directly (This is the frontend!)... ..I wonder if this would also be possible for the PageTableExtended in the backend. Just clicking on the CKEditor to change some content quickly, without opening the pagetable modal window? Has anyone already considered such a thing?
  14. Now I've got it. I feel like an idiot. I was thinking in terms of separate instances and separate pages, but forgot that all the input fields are in the same DOM tree. So they need distinct names . Actually it is all there with $attrs = $this->getAttributes(); $idstring=$attrs['id']; I just didn't know.
  15. Humm, it does not work in a repeater. It saves the same value for all items. What am I missing? Thank you. <?php /** * ProcessWire Custom InputfieldBSCol */ class InputfieldBSCol extends InputfieldTextarea { protected $cols = array("col" => "", "col-sm" => "sm", "col-md" => "md", "col-lg" => "lg", "col-xl" => "xl"); protected $sizes = array("", "auto", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"); public static function getModuleInfo() { return array( 'title' => 'InputfieldBootstrapCol', 'version' => 100, 'summary' => 'Stores Bootstrap 4 Columns Settings', 'permanent' => false, 'autoload' => false, 'singular' => false ); } public function init() { parent::init(); } public function ___render() { $values = json_decode($this->value, true); $brpval = $values['brp']; $bsizval = $values['bsiz']; $out = ''; $out .= '<select id="brp" name="brp">'; foreach ($this->cols as $key => $value) { $out .= "<option" . ($brpval == $value ? ' selected' : '') . " value=\"$value\">$key</option>"; } $out .= '</select>-'; $out .= '<select id="bsiz" name="bsiz">'; foreach ($this->sizes as $value) { $out .= "<option" . ($bsizval == $value ? ' selected' : '') . " value=\"$value\">$value</option>"; } $out .= '</select>'; return $out; } public function ___processInput(WireInputData $input) { $bs_col_options = array(); $bs_col_options['brp'] = $input['brp']; $bs_col_options['bsiz'] = $input['bsiz']; $colstr = 'col'; if ($input['brp'] != '') { $colstr .= '-' . $input['brp']; if ($input['bsiz'] != '') $colstr .= '-' . $input['bsiz']; } $bs_col_options['bcolstr'] = $colstr; $data = json_encode($bs_col_options); if ($this->value != $data) { parent::trackChange('value'); $this->value = $data; } return $this; } }
  16. Thanks for this idea and example. This makes it super easy and economical to create multi-edit field types for settings which belong together.
  17. Thank you adrian and Robin S. Changing the tree hierarchy is probably not the best idea, and it doesn't have to be for my case. A different idea is, to do it somehow like the pager. Instead of numbers, there could be letters of the alphabet or other categories. This would be less problematic imho. What do you think?
  18. Thank you adrian. This looks close and interesting, but I don't think it is very practical in my case. From what I understand reading the description, I would have to make two separate templates for every letter in the alphabet and the virtual parents would have to be real pages anyway. Am I right? Thank you.
  19. Next question. Not sure if I should open a new thread for this. Can I show some "virtual hierarchy" in the backend? For example my real page hierarchy looks like P -Aa -Ab .. -Zz Can I show something like P -A --Aa --Ab .. -Z --Zz You see the letters of the alphabet, you can "open" them, as if they were pages, but in fact they aren't real pages. It is just for grouping things better. I could add real pages for each letter of the alphabet, but I'm not sure if this makes sense. It deepens the (real) structure with no obvious benefit, other than grouping. I hope you understand what I mean. I'm completely open to any kind of thoughts regarding this matter. Thank you. EDIT: Or sth. similar to paging. Instead of 1 2 3 there would be A B C or some other criteria?
  20. Thanks Kixe. This works. I have never used ready.php before. Is there a way to use simple HTML in the headline? Like italic, bold etc. From a quick test, I see that it outputs tags as... tags.
  21. Thank you. Can I have the same for the page title / heading? I'm sorry for asking stupid questions. Many things are obvious, some things are not.
  22. Perfect! Didn't see that option... Thank you!
  23. Hello Can I define what the title shows in page lister? Is it possible to combine the title with other field values or plain text? E.g Fields are Title: MyProduct Color: Red Can Page Lister show "MyProduct (Red)" ? Or Title: 22 Can Page Lister show "22 inch" ? Thank you.
×
×
  • Create New...