Как обновить шаблон сайта до OkayCMS 2.*

Categories
Table of contents
  1. Creating translation files
  2. Data-language attribute
  3. Replacing other variables
  4. List of possible tpl-oks where you need to replace:
  5. Blog Changes
  6. Replacing captcha, adding classes for validation (optional)
  7. Change fensibox library (optional)
  8. Don't forget to upload pictures to the new site
  9. To send letters
  10. In the images folder add a picture logo.png for letters
  11. Test everything)

The guides are NOT for beginners.

  1. Creating translation files

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.

  1. Data-language attribute

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.

  1. Replacing other variables

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

  1. Blog Changes

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>

 <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>

  1. Change fensibox library (optional)

Change attributes in product.tpl and products.tpl and comprasion.tpl.

okay.js scripts.tpl change fancybox call

 {* Fancybox *}

<link href = "design /  /css/jquery.fancybox.min.css" rel = "stylesheet">

<script src = "design /  /js/jquery.fancybox.min.js" defer> </script>

  1. Don't forget to upload pictures to the new site

  2. To send letters

    Create an email folder in the design / theme name / html folder and transfer all email tpls to this folder, or you can take email tpls from the new default template.

  3. In the images folder add a picture logo.png for letters

  1. Test everything)

No reviews yet
Your commentary will be the first :)
Write your comment
Subscribe to the newsletter
You will receive a selection of useful articles on working with the site on OkayCMS, discounts on modules and templates