Skip Navigation

[Resolved] White spaces are trim on output

This support ticket is created 6 years, 4 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

This topic contains 2 replies, has 2 voices.

Last updated by alvaroM-5 6 years, 4 months ago.

Assisted by: Shane.

Author
Posts
#953513

I have created this custom shortcode in my functions.php :-

add_shortcode('format_plato', 'format_plato_shortcode');
function format_plato_shortcode($atts, $content = '') {
$content = wpv_do_shortcode($content);

$content = sprintf("%200s", $content);

return $content;
}

And I use it in Views when displaying a string field:

[format_plato][types field="plato"][/types][/format_plato]

I was expecting that the string displayed is right justified with up to 200 characters.

e.g. if [types field="plato"][/types] = "ABCD" I would expect the following to be output:

" ABCD" (*)

(*) white space preceeding ABCD are meant to be 196 white spaces.

Instead I get:

"ABCD"

i.e. preceding white spaces are IGNORED on the VIEWS output.

Can you assist with this one?

Thanks a lot.

#953720

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Alvaro,

I dont think this is a case where views is ignoring the white space. If you try this on a regular page is the result still the same ?

I'm not exactly sure what %200s means. Is there some document on this ?

Please let me know.

Thanks,
Shane

#955464

Hi,

It was a php issue - nothing to do with Toolset, please discard this ticket.

Thanks