Current time: 05-16-2024, 08:26 PM Hello There, Guest! (LoginRegister)


Post Reply 
Convert pTemplates into Smarty Templates
Author Message
zpin Offline
Junior Member
*****
Dev Team

Posts: 160
Joined: Sep 2007
Reputation: 1
Post: #10
RE: Templates
Ok, so here's what I've done so far:

- Implemented menus in include/client-functions.php, include/reseller-functions.php, include/admin-functions.php, include/commom-functions.php (new file).
- Wrote scripts to convert .php and .tpl files
- Converted all files

A few things couldn't be converted automatically, so basically the manual part of the conversion is to check every page for errors and fix them.

In the .php files this involves:
- Removing "$tpl->parse" lines (intentionally not removed by the conversion script to throw an error, because the parse function mostly means that there is a loop involved)
- Changing "$tpl->assign" to "$tpl->append" in loops
- Some "if (X) $tpl->assign('VAR', '');" that are used to control the display of a section need to be changed to either "if (!X) $tpl->assign('VAR', true);" or "if (X) $tpl->assign('VAR', 'no');" depending on how you want to handle the variable in the template. In the first case you use "{if $VAR}", in the second case "{if $VAR != 'no'}" in the template.

In the .tpl files:
- Copy over inline javascript from the old template where it's missing
- Fix loops ("<!-- BDP: * -->...<!-- EDP: * -->" to "{section *}...{/section}" and the vars inside from "{$VAR}" to "{$VAR[i]}")
- Fix conditionals ("<!-- BDP: * -->...<!-- EDP: * -->" to "{if *}...{/if}") where needed

Fixing up these things is mostly a very quick process. There are some templates which take a bit longer due to lots of loops/conditionals or variable name collisions.

Attached you will find a first draft of the patch, it should apply fine to the current trunk (r3342). If you only get a white page make sure the directory "gui/themes/omega_original/compiled" exists and is writable by the master fcgi user.
Half of the reseller section and the whole client section are still unchecked, but most of the menu points seem to work more or less already. The files I have already checked briefly:
Quote:admin/password_change.php
admin/personal_change.php
admin/language.php
admin/server_status.php
admin/admin_log.php
admin/admin_add.php
admin/reseller_add.php
admin/manage_reseller_owners.php
admin/manage_reseller_users.php
admin/circular.php
admin/settings_maintenance_mode.php
admin/ispcp_updates.php
admin/database_update.php
admin/ispcp_debugger.php
admin/rootkit_log.php
admin/reseller_statistics.php
admin/reseller_user_statistics.php
admin/ticket_closed.php
admin/multilanguage.php
admin/settings_layout.php
admin/custom_menus.php
admin/ip_manage.php
admin/settings_server_traffic.php
admin/settings_welcome_mail.php
admin/settings_lostpassword.php
admin/settings_ports.php
admin/reseller_edit.php
admin/user_delete.php
admin/domain_details.php
admin/server_statistic_day.php
admin/domain_statistics.php

reseller/language.php
reseller/settings_layout.php
reseller/domain_edit.php
reseller/user_edit.php
reseller/domain_statistics.php
reseller/domain_delete.php
reseller/user_add1.php
reseller/user_add2.php
reseller/user_add3.php
reseller/user_add4.php
reseller/alias.php
reseller/alias_add.php
reseller/alias_edit.php
reseller/settings_welcome_mail.php
reseller/settings_lostpassword.php

If anyone wants to help: Please just start in the client section from the last menu point and announce it here so we don't do duplicate work.


Attached File(s)
.gz  smarty_patch.tar.gz (Size: 254.16 KB / Downloads: 14)
09-27-2010 10:55 PM
Find all posts by this user Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Templates - Obi_Wan - 09-23-2010, 07:37 PM
RE: Templates - Nuxwin - 09-24-2010, 10:20 PM
RE: Templates - Zothos - 09-23-2010, 08:52 PM
RE: Templates - zpin - 09-23-2010, 09:01 PM
RE: Templates - Obi_Wan - 09-23-2010, 10:08 PM
RE: Templates - Obi_Wan - 09-24-2010, 10:26 PM
RE: Templates - zpin - 09-25-2010, 12:08 AM
RE: Templates - Obi_Wan - 09-25-2010, 06:44 PM
RE: Templates - zpin - 09-27-2010 10:55 PM
RE: Convert pTemplates into Smarty Templates - Nuxwin - 10-01-2010, 12:22 AM
RE: Convert pTemplates into Smarty Templates - Nuxwin - 10-20-2010, 09:59 PM

Forum Jump:


User(s) browsing this thread: 1 Guest(s)