Forum

Thread tagged as: Question

Using perch_content for a PHP variable

Hi, I need to remove whitespace for a number hyperlink

<a href="callto:<?php $string = perch_content('Mobile'); $res = preg_replace("/[^a-zA-Z0-9]/", "", $string); echo $res; ?>"><?php perch_content('Mobile'); ?></a>

But I am not able to remove white spaces, do I need to do something with that perch variable?

Raul Serrano

Raul Serrano 0 points

  • 5 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

Change:

$string = perch_content('Mobile');

to

$string = perch_content('Mobile', true);

Yea! ---- :)