Question

I am converting an old mono-lingual site to a multi-lingual site with YAMS. I have a snippet including articles based on ID

$doc = $modx->getDocument($fromId, '*', 1); // Search published first.

Is there equivalent using YAMS? Like this where the language is based on current article?

$doc $modx-yamsGetDocument($fromId, '*', 1);

Any tips would be greatly appreciated!

Était-ce utile?

La solution

I'm not familiar with YAMS, but it looks like you need to run the YAMS snippet from within your code.

You should be able to do something like this:

$result = $modx->runSnippet('YAMS', array(
    'docid' => $fromId,
    // other parameters here
));

Consult the YAMS snippet documentation for a list of parameters to include.

Autres conseils

I did this workaround, hope it helps somebody:

If you manage to bring the id of the language you could do this call:

$modx->runSnippet("getField", array('docid'=>$id_of_the_document,'field' =>'pagetitle_'.$lang));
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top