HTML Logo by World Wide Web Consortium (www.w3.org). Click to learn more about our commitment to accessibility and standards.

Moving forward with Composr

ocPortal has been relaunched as Composr CMS, which is now in beta. ocPortal 9 will be superseded by Composr 10.

Head over to compo.sr for our new site, and to our migration roadmap. Existing ocPortal member accounts have been mirrored.


tempcode in language files?

Login / Search

 [ Join | More ]
 Add topic 
Posted
Rating:
#91387 (In Topic #18388)
Avatar

Community saint

Just wondering if its possible to use tempcodes in language files.    For instance, I want some 'text' to show an image so I call:

Code

do_lang_tempcode('WHATEVER',$image)

Which brings whatever text is assoicated with 'WHATEVER' in the proper language file, and passes it a path/filename for the image I want displayed.

In the language file:

Code

WHATEVER=Select a new image to upload, or leave blank to use current one:  {$IMG,{1}}

This doesn't work, on the screen when processed it shows:

Code

Select a new image to upload, or leave blank to use current one:  {$IMG,{path/filename.png}}

Is there a way to make this work??

Paul
Back to the top
 
Posted
Rating:
#91389
Avatar

No, you'd need to make that image a parameter and pass it in. So don't pass in $image, pass in find_theme_image($image).


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#91390
Avatar

Community saint

Ok, changed it to

Code

do_lang_tempcode('WHATEVER',find_theme_image($image))

Changed language file to

Code

WHATEVER=Currently: {1}

Now I get an error that there is an image code referenced that does not exist… but it does, the files are there.


Paul
Back to the top
 
Posted
Rating:
#91391
Avatar

$image seems to be a URL, not a theme image code. If that's the case pass in get_custom_base_url().'/'.$image


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#91395
Avatar

Community saint

Still just passes the url but doesn't display the image…   have the language file as thus to test:

Code

WHATEVER=Currently:  {1}  {$IMG,{1}}

the part that calls it up changed to:

Code

do_lang_tempcode('WHATEVER',get_custom_base_url().'/'.$image)

I get this:


Paul
Back to the top
 
Posted
Rating:
#91397
Avatar

Ah, well you also need to put the HTML in the language string for an <img /> element based on the URL passed. $IMG in Tempcode wouldn't have done that either – the creates a URL for a theme image, not an HTML <img /> element for it.


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#91399
Avatar

Community saint

Ah, I wasn't aware you could write HTML directly into the language files.  That did the job.  Thanks.

Paul
Back to the top
 
There are too many online users to list.
Control functions:

Quick reply   Contract

Your name:
Your message: