Как обновить шаблон сайта до OkayCMS 2.*
- Creating translation files
- Data-language attribute
- Replacing other variables
- List of possible tpl-oks where you need to replace:
- Blog Changes
- Replacing captcha, adding classes for validation (optional)
- Change fensibox library (optional)
- Don't forget to upload pictures to the new site
- To send letters
- In the images folder add a picture logo.png for letters
- Test everything)
The guides are NOT for beginners.
Since translations in OkayCMS starting from version 2.0 are stored not in the database, but in files, you need to create these files.
To do this, add the template_update.php file to the root of the old site and run it (follow the link site.com/template_update.php).
The lang folder will appear in the active template (theme) of the old site. Let's save it to our computer and transfer it to a new site (a subdomain that already has a new OkayCMS and an updated database) in the design / theme name folder.
In all tpl templates ( design / theme name / html ), the data-language attribute is converted to this form data-language = " translation_variable" instead of data-language = ""
To do this quickly and easily, open all the files in the code editor at once and perform the replacement:
- to nothing
Typically, this can be done with the replacement hotkeys ctrl + shift + F , but there may be another combination. It all depends on the editor you are working in.
In tpl, instead of -> text and -> body, description -> description should be displayed everywhere.
Instead of -> header, it should be -> name .
To find where and in which tpl it is necessary to make a replacement - we do a search in all files by the words " -> text " , " -> body " and "-> header ".
Attention! There is no need to change the $ comment -> text variable.
List of possible tpl-oks where you need to replace:
blog.tpl,
brands.tpl,
feedback.tpl,
main.tpl,
page.tpl,
page_404.tpl,
product.tpl,
products.tpl,
post.tpl,
wishlist.tpl
Since the blog in OkayCMS 2.0 is divided into blog and news, changes must be made to blog.tpl and post.tpl.
In blog . tpl instead of
Insert
{if $ smarty.get.type_post == "blog"}
And in all links (<a> tag) in the href attribute instead of blog / insert
<script src = "design / /js/jquery.validate.min.js"> </script>
<script src = "design / /js/additional-methods.min.js"> </script> Change attributes in product.tpl and products.tpl and comprasion.tpl. okay.js scripts.tpl change fancybox call <script>
var form_enter_name = '';
var form_enter_phone = '';
var form_error_captcha = '';
var form_enter_email = '';
var form_enter_password = '';
var form_enter_message = '';
if ($ (". fn_validate_product"). size ()> 0) {
$ (". fn_validate_product"). validate ({
rules: {
name: "required",
text: "required",
captcha_code: "required"
},
messages: {
name: form_enter_name,
text: form_enter_message,
captcha_code: form_error_captcha
}
});
}
if ($ (". fn_validate_callback"). size ()> 0) {
$ (". fn_validate_callback"). validate ({
rules: {
name: "required",
phone: "required",
},
messages: {
name: form_enter_name,
phone: form_enter_phone,
}
});
}
if ($ (". fn_validate_subscribe"). size ()> 0) {
$ (". fn_validate_subscribe"). validate ({
rules: {
subscribe_email: "required",
},
messages: {
subscribe_email: form_enter_email
}
});
}
if ($ (". fn_validate_post"). size ()> 0) {
$ (". fn_validate_post"). validate ({
rules: {
name: "required",
text: "required",
captcha_code: "required"
},
messages: {
name: form_enter_name,
text: form_enter_message,
captcha_code: form_error_captcha
}
});
}
if ($ (". fn_validate_feedback"). size ()> 0) {
$ (". fn_validate_feedback"). validate ({
rules: {
name: "required",
email: {
required: true,
email: true
},
message: "required",
captcha_code: "required"
},
messages: {
name: form_enter_name,
email: form_enter_email,
message: form_enter_message,
captcha_code: form_error_captcha
}
});
}
if ($ (". fn_validate_cart"). size ()> 0) {
$ (". fn_validate_cart"). validate ({
rules: {
name: "required",
email: {
required: true,
email: true
},
captcha_code: "required"
},
messages: {
name: form_enter_name,
email: form_enter_email,
captcha_code: form_error_captcha
}
});
}
if ($ (". fn_validate_login"). size ()> 0) {
$ (". fn_validate_login"). validate ({
rules: {
email: "required",
password: "required",
},
messages: {
email: form_enter_email,
password: form_enter_password
}
});
}
if ($ (". fn_validate_register"). size ()> 0) {
$ (". fn_validate_register"). validate ({
rules: {
name: "required",
email: {
required: true,
email: true
},
password: "required",
captcha_code: "required"
},
messages: {
name: form_enter_name,
email: form_enter_email,
captcha_code: form_error_captcha,
password: form_enter_password
}
});
}
</script>
{* Fancybox *}
<link href = "design / /css/jquery.fancybox.min.css" rel = "stylesheet">
<script src = "design / /js/jquery.fancybox.min.js" defer> </script>