Hmm, how should I make this understandable? I’ll try:
I have some (species)documents with pagetitles like
Draba oxycarpa,
Draba corymbosa,
Draba fladnizensis etc. Or
Saxifraga oppositifolia,
Saxifraga cespitosa etc. (That is
Genus species). And I have a snippet called getGenusName with the code
<?php
$text = $modx->documentObject['pagetitle'];
$string = strip_tags($text);
$t =explode (' ',$string);
echo $t[0];
?>
This way I return
Draba or
Saxifraga or whatever the first part of the pagetitle from the pagetitle. So far so good.
Next, I have a container with ID=707 that contains documents. One of the documents have the pagetitle Draba, another Saxifraga. The respective content of this documents have a text (the meaning of the name Draba or the name Saxifraga etc.)
Problem: What I want is a Ditto-call in the template for the first group of documents (like
Draba corymbosa or
Saxifraga oppositifolia etc.) that takes the first part of in example Draba corymbosa, that would be Draba, and compare it with the pagetitles in container ID=707. When there is a match, like Draba matches Draba, or Saxifraga matches Saxifraga or whatever the name, then display the content-text in the container ID=707/document pagetitle=the matching name in the template for all the species-documents. The meaning of the name Draba will be displayed on all the
Draba xxxx pages, and the meaning of the name Saxifraga will be displayed on all the
Saxifraga xxxx pages.
This way, I’ll have the meening of the Genus-name displayed in all the Species-pages. Take a look at svalbardflora.net for examples (it’s a non-commersial site, and I do not collect hits).
Thanks.