Questions tagged [string]

String is a data type, which value is sequence of characters or symbols.

Filter by
Sorted by
Tagged with
1
vote
1answer
26 views

String interpolation in Redactor

I have a redactor field whose HTML contents contain links to other parts of the website. How do I render variables located in the HTML content of a Redactor field in Twig? Sample redactor content: &...
0
votes
1answer
29 views

Replace quotes in an array

I'm trying to use a charting library within a Craft template. The chart expects an array of numbers that I'm building up from a table but I'm getting an array of strings instead. {% set donutData = [...
2
votes
1answer
95 views

How to display entries filtered from more than one category

I want to try to learn how I can filter entries by multiple categories. I realise similar questions have been asked in the past, but all the answers are for specific use cases. All I want to do is ...
1
vote
1answer
121 views

Append a string to the end of all rich text links

I'm trying to append a string to the end of all rich text links. Is there an already existing plugin for this?
1
vote
1answer
30 views

Normalizing Keywords Bug

The StringHelper::normalizeKeywords() doesn't work as I expected. When I normalize überblick it leads to the expected result: StringHelper::normalizeKeywords('überblick') -> ueberblick But when ...
2
votes
1answer
157 views

Twig result/contents into string

I'm trying to adjust a google maps so have pins that correspond with my posts. I'm nearly there but I'm trying to load info into the info window. I can set it's content already by hand. And I have ...
6
votes
1answer
856 views

Replace <p> with <p class=“myClass”>

Currently I am using twig's replace filter to replace the tags: {% set str = block.body | raw %} {{ str | replace('<p>', '<p class="myClass" data-wow-duration="1s">') }} But on output it'...
8
votes
2answers
2k views

How do I get model/record attributes in their proper types, and not just strings?

Here's my record (model is nearly identical): namespace Craft; class Recurly_PlanRecord extends BaseRecord { public function getTableName() { return 'recurly_plans'; } protected ...
2
votes
2answers
1k views

Remove white space and parenthsis from global from entry variable

I am using a phone number in a global variable called {{ global.phone }} with the format "(555) 555-5555". I'd like to use that same variable/string and remove spaces, dash, and parenthesis to use for ...
6
votes
1answer
499 views

Craft.log showing Buggy iconv installed. Will fallback to mbstring

I'm curious if others are seeing a similar error in their Craft logs. It says: Buggy iconv installed. Will fallback to mbstring. It's repeated over and over seemingly with almost every request. ...
2
votes
1answer
59 views

Is there a prescribed way to to represent complex field types as strings?

I've found the need lately for a way to represent complex fieldtypes like Matrix, Entries, etc as strings. e.g. in the following plugins: https://github.com/boboldehampsink/auditlog https://github....
10
votes
2answers
4k views

How can I convert text into a URL-friendly string?

If I want to convert text into a URL friendly string for sharing text in a social media link, how would I go about that?
11
votes
1answer
2k views

What's the difference between using single and double quotes in strings?

Is there a difference between using single-quoted and double-quoted strings?
5
votes
2answers
8k views

How can I incorporate a variable into a string?

How can I incorporate a variable into a string, so that the result is a longer string that includes the contents of a given variable? For example, I have a variable called apple and its value is "...
5
votes
1answer
18k views

How to replace characters in string

How do I replace ";" with "," in string "Red; Green; Blue"? {% set rgb = "Red; Green; Blue" %}
4
votes
1answer
13k views

Is it possible to convert string to uppercase?

Is it possible to convert a simple string ("Hello World!") to uppercase ("HELLO WORLD!")?
4
votes
1answer
302 views

What's that |t - filter for?

I found this part of code in the documentation {% set title = "Cocktail Recipes"|t %} What does |t mean there?
5
votes
2answers
3k views

How to check how many characters there are in my string?

Lets say I have a simple string: {% set string = "Simple String" %} How to get number of characters of my string?
1
vote
1answer
2k views

How can I convert a dropdown field value to an integer within a hash?

I'm setting up a twitter feed with craft.twitter.get() and I need to convert a dropdown value to an integer. Here is my code far: {% set cacheTime = sidebarBlock.twitterFeedCacheTime %} {% set tweets ...