Plugin

Archived
Forum
(read-only)

String

ExpressionEngine 1.x, ExpressionEngine 2

Back to this add-on's main page
View Other Add-ons From eMarketSouth

     

String with P&T Matrix (Need help)

Support Request

Kippi
Kippi

Hi,

I have a matrix field called “embedded_images” with three columns:

1) image (this first column is a “copee pastee” cell type, enabling me to copy and paste “image_1”, “image_2”, etc into the “summary” field.
2) image_upload
3) image_text

Im trying to use String to place an image in an entry and can successfully do this but when I add the “image_text” tag neither the image or the “image_text” appears.

My code looks like this:

{exp:channel:entries channel="news"}

{embedded_images}
{exp
:string:set name="image_{row_count}"}
<img src="{image_upload}">
{image_text}
{
/exp:string:set}
{
/embedded_images}

{exp
:string:output}
{summary}
{
/exp:string:output}

{
/exp:channel:entries} 

Any help with this would be appreciated.

Thanks

 

eMarketSouth
# 1
Developer
eMarketSouth

Hello Kippi,

I’m not sure I understand your code fragment, it looks like something is missing.  Should there be a {exp:string:append name=“summary”} tag pair inside the {embedded_images} tag pair?

Sincerely,
Jack Scott

Kippi
# 2
Kippi

Hi,

Thanks for the reply.
Im not sure what you mean? Can you elaborate.

eMarketSouth
# 3
Developer
eMarketSouth

From looking at your code fragment, you don’t appear to be setting the summary string at all.  Try something like:

{exp:channel:entries channel="news"}

{embedded_images}
{exp
:string:set name="image_{row_count}"}
<img src="{image_upload}">
{image_text}
{
/exp:string:set}
{exp
:string:append name="summary"}{image_text}{/exp:string:append}
{
/embedded_images}

{exp
:string:output}
{summary}
{
/exp:string:output}

{
/exp:channel:entries} 

Sincerely,
Jack Scott

[edited October 2 - fixed an code error]

Kippi
# 4
Kippi

Hi,

Thanks for your fast reply.
I tried your code but unfortunately it didinĀ“t work.

My template is outputting this:

Image Text{/exp:string:set} {image_1}


So the “image text” is being outputted but not the “image”

eMarketSouth
# 5
Developer
eMarketSouth

I found and fixed an error in the previous sample, I had an exp:string:set close tag instead of a exp:string:append close tag.  Try the previous code sample again.

Are you using the String module to change a matrix field from a template?  String can’t change a channel or matrix field, all it does is store strings in one part of your template and recall them later on.