Jump to content

Juergen

Members
  • Content Count

    951
  • Joined

  • Last visited

  • Days Won

    1

Juergen last won the day on November 5 2017

Juergen had the most liked content!

Community Reputation

449 Excellent

About Juergen

  • Rank
    Hero Member

Profile Information

  • Gender
    Male
  • Location
    Linz
  • Interests
    Playing electric guitar (Rock, Heavy), flying model helicopters

Recent Profile Visitors

5,129 profile views
  1. 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
  2. Juergen

    SeoMaestro

    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
  3. Juergen

    SeoMaestro

    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
  4. Juergen

    SeoMaestro

    Thank you @Wanze for the additions (especially for the structured data)!!
  5. Juergen

    SeoMaestro

    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:
  6. Juergen

    SeoMaestro

    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
  7. Juergen

    SeoMaestro

    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.
  8. Juergen

    SeoMaestro

    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
  9. 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
  10. 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
  11. Thanks @adrian for the quick fix!! It works as expected!
  12. 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
×
×
  • Create New...