Answer the question
In order to leave comments, you need to log in
How to correctly implement the output of phones in ModX?
Hello!
How to correctly implement the output of phones?
Through additional fields so that the number is wrapped in a span tag.
Example:
<span>номер телефона 1</span>
<span>номер телефона 2</span>
Answer the question
In order to leave comments, you need to log in
Hey! you can use snippet
<?php
$id = (isset($id)) ? $id : '';
$tvname = (isset($tvname)) ? $tvname : '';
$resource = $modx->getObject('modResource', $id);
$phone = $resource->getTVValue($tvname);
$phone_edit = preg_replace("/[^0-9]/", '', $phone);
echo '<span><a href="tel:+'.$phone_edit.'">'.$phone."</a></span>";
where id is the resource number of the tv phone tv name is the name of the tv phone. in the snippet in the echo line you can set the required output template Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question