Page 1 of 1

[solved] smarty mailto does not work anymore in CMSms 2.0

Posted: Sun Dec 06, 2015 7:24 pm
by reinhardmohr
Hi,
I am working on a new site with CMSms 2.0 – and I think when I get used to it a bit more this could be a great release.
But it would be great if anybody could help me with a problem with the smarty {mailto} function that I never encountered with the 1.x series!
Here is my configuration:

Code: Select all

----------------------------------------------
Cms Version: 2.0.1.1
Installed Modules:
AdminSearch: 1.0
FileManager: 1.5.1
MysqlDump: 1.3.1
MicroTiny: 2.0
ModuleManager: 2.0
News: 2.50.1
Search: 1.50.1
ThemeManager: 1.1.8
CMSContentManager: 1.0.1
DesignManager: 1.0.1
FileBackup: 0.5
Navigator: 1.0.1

Config Information:
php_memory_limit:
max_upload_size: 1024000000
url_rewriting: none
page_extension:
query_var: page
auto_alias_content: true
locale:
set_names: true
timezone: Europe/Berlin
permissive_smarty: false

Php Information:
phpversion: 5.6.15
md5_function: An (Ja)
json_function: An (Ja)
gd_version: 2
tempnam_function: An (Ja)
magic_quotes_runtime: Aus (Nein)
E_STRICT: 0
E_DEPRECATED: 0
test_file_timedifference:
test_db_timedifference:
memory_limit: 2040M
max_execution_time: 1200
output_buffering: 4096
file_uploads: An (Ja)
post_max_size: 2040M
upload_max_filesize: 1024M
session_save_path: Keine Prüfung, da eine „open basedir“-Beschränkung aktiviert ist
session_use_cookies: An (Ja)
xml_function: An (Ja)
xmlreader_class: An (Ja)

Performance Information:
allow_browser_cache: Aus (Nein)
browser_cache_expiry: 60
php_opcache: Aus (Nein)
smarty_cache: Aus (Nein)
smarty_compilecheck: Aus (Nein)
smarty_cache_udt: Aus (Nein)
auto_clear_cache_age: Aus (Nein)
Server Information:
Server Api: fpm-fcgi
Server Db Type: MySQL (mysqli)
Server Db Version: 5.5.44
Server Db Grants: „Alles gewähren“-Anweisung gefunden, die als geeignet scheint
Server Time Diff: Keine Abweichung der Zeit im Dateisystem gefunden

----------------------------------------------
My problem:
I made a "new global content block" as advised in the documentation with

Code: Select all

{page_attr page=”*page alias from above *” key=”foo”}
This works well. But when I add a smarty encoded mail address there with

Code: Select all

{mailto address='info@abcd.ef' encode='javascript'}
then this code prints out on my webpage – instead of resulting in an encoded clickable mail address.
I tried to temper a little bit with {eval}. And I was wondering if this problem had to do with the newly introduced scope for smarty. But as I am no smarty specialist I couldn't get the thing to work.
I even tried assigning the mailto output to a variable and print out the variable – didn't work either.
When I used the same mailto-code and put it directly into my template right underneath the "new global content block" it worked without any problem.
Could someone give me a hint or provide me with the proper line of code? This would really help a lot!

Thanks for helping

Reinhard

Re: smarty mailto does not work anymore in CMSms 2.0

Posted: Sun Dec 06, 2015 7:47 pm
by calguy1000
The {page_attr} tag does not treat a content block as a smarty template. It returns the exact contents of that block. However {content} does.

If you want to treat it as a smarty template, you will need to do it explicitly:

Code: Select all

{page_attr page='some page alias' key='blockname' assign='blockname'}
{eval var=$blockname
}

Re: smarty mailto does not work anymore in CMSms 2.0

Posted: Mon Dec 07, 2015 3:12 pm
by velden
Why don't you create to input ONLY the email-address? It seems awkward to ask editors for a smarty tag:

http://forum.cmsmadesimple.org/viewtopi ... 51#p323751
http://forum.cmsmadesimple.org/viewtopi ... 41#p325041

Re: smarty mailto does not work anymore in CMSms 2.0

Posted: Mon Dec 07, 2015 7:50 pm
by reinhardmohr
Hi, Calguy and Velden,

thanks for helping!
As Calguy proposed I assigned the mailto-code to a variable and then used eval to have it output – it works.

Thanks, Velden, for your ideas about using the new version of global content blocks. I see the benefits. And I see why the system of GCBs was changed from a developers point of view and why it maybe better.

I‘m beginning to see the benefits and the advantages of version 2.x. But I still remember when I showed the old gobal content blocks to my customers – they found it simple and got the idea very easily. And – most important of all – they were indeed impressed that this was possible with a CMS and that they themselves could do this kind of magic.
This magic and this easiness for the customers is now lost a little bit. I see the benefits for which this was exchanged. But I still regret it a bit …
Nonetheless I see that the Dev Team has worked hard on improving CMSms. And that they did it for free and with a background of programming knowledge that I do not possess. So in the end everything will work out fine. And again: Thank you, guys, for making CMSms! And for helping in this forum!

Thanks

Reinhard