-
Posts
1,306 -
Joined
-
Last visited
-
Days Won
13
Everything posted by Juergen
-
Hello, I have tried to get the config data of the ProcessPageAdd module because I need the pages which are inside the ASM-Select for the 'Add new' shortcuts. This is what I have tried according to the docs: $data = wire('modules')->getConfig('ProcessPageAdd'); print_r($data); But the only output I get is 1(true). Is there something I am missing or is this the wrong way? Maybe someone can help me out. Thanks
-
CKEditor Inputfield and multiple content stylesheets
Juergen replied to Juergen's topic in General Support
Thanks @dragan I use a custom style set for special UIKit markup classes. Including the code inside this file does not work too. BTW this file should be used to add custom styles to the dropdown not for configuration of the stylesheets. The docs of PW says that the configuration changes should be written inside /site/modules/InputfieldCKEditor/config.js I have tried it but without success. ? -
Hello @ all, I am struggeling to add multiple stylesheets to the CKEditor content area. Docs from CKEditor says that it is possible to add a string or an array as source for the stylesheets. Inside the CKEditor settings tab there is an input field where you can add a path to a custom stylesheet. This works only if I enter only one stylesheet (string) - if i try to enter an array it fails and falls back to the default stylesheet. Therefore I have tried to add the stylesheets to the config-body.js directly (because the field is called body) CKEDITOR.editorConfig = function( config ) { config.contentsCss = ['https://cdnjs.cloudflare.com/ajax/libs/uikit/3.1.6/css/uikit.min.css', '/site/modules/InputfieldCKEditor/admin.css']; }; But this does not work either. Has someone an idea to get it working? Best regards
-
That will be great ?! Thanks for you contribution @MoritzLost
-
Thanks @teppo this is a very clear explanation. Chaining is only possible with a reference to the object itself not with a string. You are right: my method for text is a combination of a setter an a getter and the getter will always return a string or null, so no reference to the object itself. So I ended up separating getter and setter into 2 different methods and now it works with or without chaining: public function setText(string $value = null) { $this->text = trim($value); return $this; } public function getText() { return $this->text; } In other forums they also do not recommend to combine getter and setter in one method. I thought that combining both would be an useful and elegant way - so I have learnt something new ?! Thanks! It helps me a lot!!
-
Hello @ all, I am learning OOP and I have a problem for which i didnt find a solution in the web. Maybe someone can help me out. I have written a class to render alerts. Fe. to output an alert box I can write: default notation: $alert = new Alert(); $alert->text('This is the alert text'); echo $alert->render(); or with method chaining: echo (new Alert())->text('This is the alert text')->render(); Both methods work until text has content inside. So sometimes there is no text content present (text value is empty). default notation (this works): $alert = new Alert(); $alert->text(); echo $alert->render(); or with method chaining (this leads to an error): echo (new Alert())->text()->render(); So if text has no value I get this error if I use method chaining: Call to member function render on null This is the getter/setter method for the text public function text(string $value = null) { if($value){ $this->text = trim($value); return $this; } else { return $this->text; } } Is there a way to get method chaining to work if there is no value in the text property present? Thanks for your help
-
Thank you @Wanze, I have tried this before, but without luck. Now I see what went wrong - I haven´t used camelcase (noindex instead of noIndex) - silly mistake ?
-
Hi, I am struggeling with a problem to set the robots metatags (noIndex, noFollow) within a before page save hook. Here is my code (inside ready.php): $pages->addHookBefore('save', function($event) { $page = $event->arguments('page'); if($page->template == 'privacy-policy' || $page->template == 'search' || $page->template == 'error') { //SEO Maestro $page->seo->sitemap->include = 0; $page->seo->sitemap->priority = ''; //How to set robots to no index and no follow //??????????? } }); I could not figure out a way to accomplish this. Can anyone help me out? Thanks
-
Thank you @Wanze for the additions (especially for the structured data)!!
-
I wanted to create a HTML Sitemap with the same pages as the XML sitemap. Unfortunately the $pages->find() method doesn´t support the order of the page tree, so I could not use the provided function to get all pages from the XML-Sitemap in the same order as the page tree. $pages->find('seo.sitemap_include=1'); So I wrote a little recursive function to render all the pages except the ones which were not included in the XML sitemap. The pages have the same order as in the page tree. function renderSitemap($items, $depth = 0) { $separator = ''; for ($x = 0; $x <= $depth; $x++) { $separator .= '-'; } foreach ($items as $item) { if ($item->seo->sitemap->include == 1) { $subitems = $item->children(); if (count($subitems)>0) { echo '<b>'.$separator.$item->title . '</b><br />'; } else { echo $separator.$item->title . '<br />'; } $subitems = $item->children(); renderSitemap($subitems, $depth+1); } } } //OUTPUT INSIDE TEMPLATE FILE $items = $pages->get("/")->children(); echo '-'.$pages->get("/")->title.'<br />';//this is only for the homepage renderSitemap($items); This little function is not intended as a complete HTML sitemap markup generation solution. It only outputs the title of the pages (without links). It should only be a starting point for others to show you how to use SEOMaestro settings in combination with a frontend sitemap. Maybe if someone has a better solution it would be great if you post it here. Best regards This is what it looks like:
-
Hello @Peter Knight I think that there is no render tag method for the robot tags, but you can use the following: $page->seo->robots->data['noIndex'] $page->seo->robots->data['noFollow'] This returns true if 'no index' was choosen and true if 'no follow' was choosen. Create the meta tags by yourself and use PHP to fill in these values into the meta tags. Best regards Jürgen
-
I have not installed this module and I have the same problem. On my current installation I have only installed a few modules. So I guess it has nothing to do with other modules.
-
Thank you @Wanze for this great module. Only one thing to mention: From the point of security it is not recommended to add the generator metatag (or any other information to help hackers to know something about the system). So it would be great to add a setting checkbox to disable the rendering of this metatag. I know I can render each metatag separately but using your render method ($page->seo->render()) would be much more comfortable ?. Best regards Jürgen
-
If I understand you correctly, you have added a new image field to your template for the featured image and you need the url for the src attribute. ? Lets assume the name of the new image field is 'featured_image' you will get the url of this image by using $page->featured_image->url So the code of the blog-post.php could look like this: <?php $img = $page->featured_image; if($img) { $img = $img->width(600); echo "<p class='uk-text-center'><img src='$img->url' alt='$img->description'></p>"; } ?> Image is an object, so you have to grab the different values (attributes) of the image by using the arrows (->) followed by the name of the attribute (size, url,...). You will find more information about getting image values here If this was not the information you are asking for please post your code for better understanding. Best regards
-
Module: AIOM+ (All In One Minify) for CSS, LESS, JS and HTML
Juergen replied to David Karich's topic in Modules/Plugins
Hello, I always get this warning with Tracy: PHP Warning: A non-numeric value encountered in .../site/modules/AllInOneMinify/AllInOneMinify.module:713 This is the line of code: $_timestamp = ($_timestamp + $file['last_modified']); It seems that one of the two values is not in the right format. Best regards -
Thanks @adrian for the quick fix!! It works as expected! ?
-
Hello @adrian is it possible to disable the input field length fe style="width:60px;" by entering something into the settings field? If not, it would be great if you add the possibility to enter fe a "-" to disable the rendering of the style attribute. This could be useful if you are using the UIKit template because there are various input length classes ('uk-form-width-medium'....) and you dont need the input field length. Best regards Jürgen
-
[SOLVED] How to display field's label on error messages?
Juergen replied to PWaddict's topic in General Support
Thanks for the hint! -
Hello @ all, only a simple question: Is it possible (and if how) to distinguish if a page was saved via fe a save ready hook or manually by pressing the save button? I have the problem that a special hook function should only run if the save button was pressed by a human. In my case the schedule pages module triggers a hook to set a child page status to unpublished and saves the child page and this save process leads to start another hook which changes some values in the parent page. I only want to run this hook for the parent page if the child page was saved by pressing the save button and not by saving via a hook. if(Save button was pressed) { // run the hook } else { // do not run the hook } Maybe someone has struggled with the same problem and can give me a hint how to deal with this? Best regards
-
[Solved] Adding a label to image field description input
Juergen replied to LMD's topic in General Support
@dragan On my screen the label "Description" is also not visible. It is also not visible in the sourcecode. I am using PW dev version 101 (latest). Same for the tags label if I enable them. Admin Theme UIKit. Best regards- 6 replies
-
- images
- image field
-
(and 1 more)
Tagged with:
-
It would be great if an optional text field will be added to the inputfield integer to add additional text next to the integer field (fe. weeks, days,..). Multilanguage support would be nice .
-
Bug column width in UIKit admin template using if conditions
Juergen replied to Juergen's topic in General Support
Hello @Robin S Thanks for this information. I have set the width of the last 2 cols to 17% and now it works. It doesn`t seem very logical to me, because I have thought that the width of the non visible col will be automatically set to 0%, but dividing it by two solves the problem. Thousand thanks, you have made my day!! Would be great if this info will be added to the docs. -
Bug column width in UIKit admin template using if conditions
Juergen replied to Juergen's topic in General Support
Thanks @ryan I have downloaded the uikit admin template from the dev branche, but unfortunately the problem is still there. Now it is not in the last column but in the second one. Afterward I will try to show you what happens. These are the column widths in my template settings for the 4 fields. Remember the last 2 fields changes depending on the option selected in the second field. So the field named "repeatuntilmonthtype" is a select option field. Depending on its settings the field "repeatuntilmonthnumber" or "repeatuntilmonthdate" will be displayed. Both field have a length of 34% to fit 100% at all. On the first view everything looks ok: Here are the corresponding CSS-classes for each column (from first to last) which were added to the li-tag: First row: Inputfield InputfieldInteger Inputfield_repeatmonthsnumber InputfieldStateRequired InputfieldStateRequiredIf InputfieldColumnWidth InputfieldColumnWidthFirst uk-first-column uk-width-1-3@m InputfieldRowFirst Second row: Inputfield InputfieldSelect Inputfield_repeatuntilmonthtype InputfieldStateRequired InputfieldColumnWidth InputfieldStateChanged uk-width-1-3@m InputfieldRowFirst Third row: Inputfield InputfieldInteger Inputfield_repeatuntilmonthnumber InputfieldStateShowIf InputfieldStateRequiredIf InputfieldColumnWidth uk-width-1-3@m InputfieldColumnWidthLast InputfieldStateRequired InputfieldRowFirst After changing the option in the select field (field in column 2) it looks like this: So this looks like the same problem like in my post before: Here are the CSS-classes: First row: Inputfield InputfieldInteger Inputfield_repeatmonthsnumber InputfieldStateRequired InputfieldStateRequiredIf InputfieldColumnWidth InputfieldColumnWidthFirst uk-first-column uk-width-1-3@m InputfieldRowFirst Second row: Inputfield InputfieldSelect Inputfield_repeatuntilmonthtype InputfieldStateRequired InputfieldColumnWidth uk-width-2-3@m InputfieldStateChanged InputfieldRowFirst Third row: Inputfield InputfieldDatetime Inputfield_repeatuntilmonthdate InputfieldStateShowIf InputfieldStateRequiredIf InputfieldColumnWidth InputfieldColumnWidthFirst uk-first-column InputfieldNoFocus InputfieldColumnWidthLast uk-width-expand InputfieldStateRequired uk-grid-margin Please notice the CSS-class of the second field has changed to "uk-width-2-3@m" which should be "uk-width-1-3@m". The CSS class of the last column is now correct with "uk-width-expand", but "uk-width-1-3@m" should be better. So the main problem is now in the CSS class of the second column. Previously the problem was located in the third (last) column. Only to mention: All these fields will only be displayed if a checkbox is set to true (another dependency). I dont know if this is important to know or not. Best regards Jürgen