Hi Thyon,
I really like your extension, but I think it might need some improvement. I was trying to use a standard navigation together with a custom navigation on a website. Both of them contained identical links. But only one navigatin should use image replacement via image_headline. But the extension always replaced links in both navigation bars. I tried several CSS-selectors to solve the problem but nothing really worked out.
Then I started to analyse your ImageHeadline.php - especially the replaceHeadlines function. Well, I'm probably no expert, but I think the problem is here:
Code:
$outertext = str_replace(">".$element->innertext."<", ">".$imageHeadline."<", $element->outertext);
$buffer = str_replace($element->outertext, $outertext, $buffer);
The extensions creates a new outertext and replaces any match in the buffer. By doing so, it doesn't check for the right selectors, but only matches the elements with an identical outertext. Unfortunately all links targeting the same page in different navigations have an identical outertext. I think you can fix this problem by modifying and saving the dom - at least it worked out pretty well for me:
Code:
$outertext = str_replace(">".$element->innertext."<", ">".$imageHeadline."<", $element->outertext);
$element->outertext = $outertext;
$buffer=$html->save();
What do you think?
Bookmarks