D
D
Dmitry Mazikin2019-07-29 10:32:18
MODX
Dmitry Mazikin, 2019-07-29 10:32:18

How to make a TV field a link in your snippet?

Hello . When calling my snippet, I need to make the output of the TV field a link.
snippet code

<?php
$url = $modx->makeUrl($parent);

$resource = $modx->getObject('modResource', $parent);
$ankor_filter = $resource->getTVValue('ankor_filter');

//var_dump ($url);

if (empty($ankor_filter))
     print_r($ankor_filter);

return $ankor_filter;

//var_dump($parent);

Here I get the url of the parent, id and the TV field that is written in it, if it is empty or not.
Here is the calling code

On output, it prints the value in the tv field if it is not empty. But I can’t figure out how to make it a link so that it would be fashionable to go by name to the parent section.
Here is the screenshot of the output5d3ea0ff1825e768424131.png

Answer the question

In order to leave comments, you need to log in

2 answer(s)
K
kalapanga, 2017-11-20
@kalapanga

Author, have a conscience and at least sometimes go to classes!
Here you have a number search procedure, but you never call it!

L
Lander, 2017-11-20
@usdglander

In the range of an unsigned integer, it will be easier to use an array:
6,
28,
496,
8128,
33 550 336,

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question