Hey everyone
I am trying to get a php calendar to work inside the CMS. I now that there is a CMS but people have paid money and want to see it in use.
I have enabled the $config['use_smarty_php_tags'] = true; and been trying the {php}{/php}, although I would not put it past myself to not understand.
I just updated tonight.
PHP:5.2.17
CMS: 1.9.4.2
My test site. You will see the first error at the top.
http://shadowscourt.com/ealdormere2/
I have to muddle through the other pages so I will leave it along for a while.
Thank you.
(SOLVED) Lost in PHP translation
(SOLVED) Lost in PHP translation
Last edited by dmagill on Wed Jul 27, 2011 4:15 am, edited 1 time in total.
Re: Lost in PHP translation
Why don't you try and use a UDT (User-Defined Tag)? You can insert your custom PHP code into a new UDT and then simply call the UDT in your template at the appropriate location.
-S
-S
Re: Lost in PHP translation
Thank you spcherub.
Turns out I did not have to use a UDT.
To make the Easy PHP Calendar Work:
This is what I did. As of todays date, my CMS is current.
In the config file I made sure this was on: $config['use_smarty_php_tags'] = true
Usually you need a chunk of code to call the calendar in the <head> section but that did not work for me. Instead, after working in this for a few hours and reading far more, I put it all in the text body (editor window) where I wanted the small calendar and did the same for the List Calendar.
<!-- all together || small calendar with popups -->
{php} $CSS=1; require("calendar/calendar.php"); {/php}
{php} $OL=1; require("calendar/calendar.php"); {/php} {php} require("calendar/calendar.php"); {/php}
<!-- END OF all together -->
<!-- LIST CALENDAR and three small calendars at top -->
{php} $CSS=1; require("calendar/calendar.php"); {/php} {php} $MULTI=1; $epcMultiWidth = "600px"; $epcMultiPad = 10; $epcMultiNav = "580px"; $epcMultiCol = 3; $epcMultiRow = 1; require ("calendar/calendar.php"); {/php} {php} $LIST=1; $DF = "D - M d"; $template="monthly.php"; $noOld = 1; $listMonths = 24; require ("calendar/calendar.php"); {/php}
<!-- END of LIST CALENDAR and three small calendars at top -->
I did not put anything into my template.
Examples: http://www.ealdormere.ca/
http://www.ealdormere.ca/index.php?page=list-calendar
I did nothing else. My one major stumbling block was the path, and I did that to myself when I backed up the site.
Thanks!
D
Turns out I did not have to use a UDT.
To make the Easy PHP Calendar Work:
This is what I did. As of todays date, my CMS is current.
In the config file I made sure this was on: $config['use_smarty_php_tags'] = true
Usually you need a chunk of code to call the calendar in the <head> section but that did not work for me. Instead, after working in this for a few hours and reading far more, I put it all in the text body (editor window) where I wanted the small calendar and did the same for the List Calendar.
<!-- all together || small calendar with popups -->
{php} $CSS=1; require("calendar/calendar.php"); {/php}
{php} $OL=1; require("calendar/calendar.php"); {/php} {php} require("calendar/calendar.php"); {/php}
<!-- END OF all together -->
<!-- LIST CALENDAR and three small calendars at top -->
{php} $CSS=1; require("calendar/calendar.php"); {/php} {php} $MULTI=1; $epcMultiWidth = "600px"; $epcMultiPad = 10; $epcMultiNav = "580px"; $epcMultiCol = 3; $epcMultiRow = 1; require ("calendar/calendar.php"); {/php} {php} $LIST=1; $DF = "D - M d"; $template="monthly.php"; $noOld = 1; $listMonths = 24; require ("calendar/calendar.php"); {/php}
<!-- END of LIST CALENDAR and three small calendars at top -->
I did not put anything into my template.
Examples: http://www.ealdormere.ca/
http://www.ealdormere.ca/index.php?page=list-calendar
I did nothing else. My one major stumbling block was the path, and I did that to myself when I backed up the site.
Thanks!
D
Re: (SOLVED) Lost in PHP translation
I'm glad this worked out for you in the way you described. I have a couple of closing thoughts however, FWIW:
- Enabling embedded PHP code can be problematic, especially from a security standpoint. If you have other users who contribute to the site, they could break the site easily if they did not know what they are doing. They could also leave security holes that can be exploited by others.
- If you are going to use PHP code, it is better to place it in the template directly or place it in a global content block which you then call in the template. The WYSIWYG tends to mangle code sometimes and you could run into a problem when you edit the page the next time and find the originally pasted PHP code is broken. Putting it into a GCB at least prevents this problem (as long as you disable the WYSIWYG on the GCBs).
- For security reasons stated above, the UDT is the best and safest way to use custom code with out having to enable PHP code. Also this allows for clean separation of PHP, Smarty and HTML in your system which can reduce confusion during future edits.
Of course all of the above are just guidelines - if your site is relatively small and static and you are the only admin making edits, you should be fine.
Thanks,
-S
- Enabling embedded PHP code can be problematic, especially from a security standpoint. If you have other users who contribute to the site, they could break the site easily if they did not know what they are doing. They could also leave security holes that can be exploited by others.
- If you are going to use PHP code, it is better to place it in the template directly or place it in a global content block which you then call in the template. The WYSIWYG tends to mangle code sometimes and you could run into a problem when you edit the page the next time and find the originally pasted PHP code is broken. Putting it into a GCB at least prevents this problem (as long as you disable the WYSIWYG on the GCBs).
- For security reasons stated above, the UDT is the best and safest way to use custom code with out having to enable PHP code. Also this allows for clean separation of PHP, Smarty and HTML in your system which can reduce confusion during future edits.
Of course all of the above are just guidelines - if your site is relatively small and static and you are the only admin making edits, you should be fine.
Thanks,
-S
Re: (SOLVED) Lost in PHP translation
Hey spcherub
I did read the security concerns and I am not overly happy, but so far this is the only way I have found that works right out of the box.
Although I will more then likely move the code into a Global Content block for ease of management.
The site is silly in it's size. And I am left to ponder what the original designers where thinking. I just get the left overs.
Thanks again.
D
I did read the security concerns and I am not overly happy, but so far this is the only way I have found that works right out of the box.
Although I will more then likely move the code into a Global Content block for ease of management.
The site is silly in it's size. And I am left to ponder what the original designers where thinking. I just get the left overs.
Thanks again.
D