News module rel = prev next

dbs

Looks professional and works. Thank you very much  (Y)
I had tried also with preg_match_all and foreach, but ... forget it.  :-)
[url="https://onkel-franky.de"]https://onkel-franky.de[/url]

DarkViper

2 in 1  only?
if, then n in 1 please  ;-)
<?php // this line is only for color reasons, don't copy this

    
$sPage '';
    
$sPattern '/class=\"news-(?P<rel>next|prev)-page\"[^>]+?href=\"(?P<url>[^\"]*)\"/siu';
    if (
false !== preg_match_all($sPattern$wb_page_data$aMatchesPREG_SET_ORDER)) {
        foreach (
$aMatches as $aMatch) {
            
$sPage .= '<link rel="'.$aMatch['rel'].'" href="'.$aMatch['url'].'">'.PHP_EOL;
        }
        
$wb_page_data str_replace('</head>'"\n\t".$sPage.'</head>'$wb_page_data);
    }
    return 
true;
[url=http://www.youtube.com/watch?v=tmzDAz6ZvFQ]Der blaue Planet[/url] - er ist nicht unser Eigentum - wir haben ihn nur von unseren Nachkommen geliehen[br]
[i]"You have to take the men as they are... but you can not leave them like that !" :-P [/i]
[i]Das tägliche Stoßgebet: [b]Oh Herr, wirf Hirn vom Himmel ![/b][/i]

dbs

Looks a little bit better and shorter. Thx.
2 in 1 is maybe also possible. Will try it.
[url="https://onkel-franky.de"]https://onkel-franky.de[/url]

DarkViper

<?php // this line is only for color reasons, don't copy this

if (preg_match('#class=\"news-next-page\"[^>]+?href=\"([^\"]*)\"#'$wb_page_data$matches)) {
    
$page  '<link rel="next" href="'.$matches[1].'">';
}

if (
preg_match('#class=\"news-prev-page\"[^>]+?href=\"([^\"]*)\"#'$wb_page_data$matches)) {
    
$page .= '<link rel="prev" href="'.$matches[1].'">';
}

$wb_page_data str_replace('</head>',"\n\t".$page.'</head>',$wb_page_data);
return 
true;

:-)
[url=http://www.youtube.com/watch?v=tmzDAz6ZvFQ]Der blaue Planet[/url] - er ist nicht unser Eigentum - wir haben ihn nur von unseren Nachkommen geliehen[br]
[i]"You have to take the men as they are... but you can not leave them like that !" :-P [/i]
[i]Das tägliche Stoßgebet: [b]Oh Herr, wirf Hirn vom Himmel ![/b][/i]

dbs

Hello, for SEO reasons, if news have pagination, i want in the <head>:
<link rel="prev(or next)" href="?p=n">

My try
In news module view.php added 2 classes (news-next-page, news-prev-page) in lines 152 to 171 (4 times) for the generated prev-next-links.

Created a droplet and added it to the settings footer of news module
<?php // this line is only for color reasons, don't copy this

// adds <link rel="prev|next" href="?p=nn"> at the end of the <head>
// only if news has pagination
// for SEO reasons (dynamic parameters) 

preg_match("#class=\"news-next-page\" href=\"([^\"]*)\"#",$wb_page_data,$matches);
$page  = !empty($matches[1]) ? '<link rel="next" href="'.$matches[1].'">' '';

preg_match("#class=\"news-prev-page\" href=\"([^\"]*)\"#",$wb_page_data,$matches);
$page .= !empty($matches[1]) ? '<link rel="prev" href="'.$matches[1].'">' '';

$wb_page_data str_replace('</head>',"\n\t".$page.'</head>',$wb_page_data);
return 
true;


This works, but i know it is no good code.
Maybe somebody can optimize it. :-)
[url="https://onkel-franky.de"]https://onkel-franky.de[/url]