Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Template Questions /

Concatenate variables


Reply


5 Posts   1957 Views

Avatar
CraigB

Community Member, 7 Posts

17 June 2009 at 10:04am

I am trying to Take a custom field for a page and use it as a part of a link to some pre generated documentation.
The link has the following format:
/products/$ProductCode Release/output/index.htm
I want to be able to remove the space after $ProductCode.

The result I want to endup with is as follows:
/products/PWRelease/output/index.htm

Where $ProductCode is "PW"

Thanks

Craig

Avatar
Howard

Community Member, 215 Posts

17 June 2009 at 11:35am

Yup just go:

/products/{$ProductCode}Release/output/index.htm

:)

Avatar
CraigB

Community Member, 7 Posts

17 June 2009 at 11:49am

Thanks for that.

You wouldn't also no how to use page variables in a function for the page?
ie.    function DocURL() {
      return '/products/'.$ProductCode.'Release/output/index.htm';
   }

This doesn't seem to work, the Product code is never populated.

Avatar
Howard

Community Member, 215 Posts

17 June 2009 at 11:56am

Yea you cant use template variables in the php code but you can do:

function DocURL() {
$product = $this->ProductCode;
return '/products/'.$product.'Release/output/index.htm';
}

Avatar
CraigB

Community Member, 7 Posts

17 June 2009 at 12:04pm

Thanks again.

That seems like a bit of a limitation but at least there is a way to get it to work.

Cheers