ZenCart function - commonly used functions

Common Functions

zen_get_module_directory

Function Description: Get the directory module. Implements includes / modules / *. Php rewrite module.

This function simply returns the name of the module

        var_dump(zen_get_module_directory('downloads'));echo '<hr />';//"CUSTOM/downloads.php"
        var_dump(zen_get_module_directory('downloads',true));echo '<hr />';//"CUSTOM/"

Example calls

<?php require(DIR_WS_MODULES . zen_get_module_directory('column_left.php')); ?>

A brother function of this function is

zen_get_file_directory($check_directory, $check_file, $dir_only = 'false')

This function should be more powerful function

$lang_file = zen_get_file_directory(DIR_FS_CATALOG . DIR_WS_LANGUAGES . $_SESSION['language'] . '/modules/order_total/', $value, 'false');

$lang_file = zen_get_file_directory(DIR_WS_LANGUAGES . $_SESSION['language'] . '/modules/order_total/', $value, 'false');

var_dump(zen_get_file_directory(DIR_WS_MODULES, 'attributes.php', $dir_only = 'false'));echo '<hr />';//"includes/modules/attributes.php"

You can check the relative directory from the point of view function call, an absolute directory

zen_href_link

Function Description: Construction of a link. function zen_href_link ($ page = '', $ parameters = '', $ connection = 'NONSSL', $ add_session_id = true, $ search_engine_safe = true, $ static = false, $ use_dir_ws_catalog = true)


25 sideboxes in particular search_header.php

Directory E: \ wamp64 \ www \ ZenCart156cDev \ includes \ modules \ sideboxes

search_header.php not really a sideboxes, it provides an idea of ​​how to solve the problem of global calls sideboxes?

search_header.php call the following example

<?php require(DIR_WS_MODULES . 'sideboxes/search_header.php'); ?>

The rest of sideboxes are called by the module column_left.php

The advantages and disadvantages of doing that? Does not override mechanism provided by the column_left.php


Most used link

<?php echo zen_href_link(FILENAME_LOGOFF, '', 'SSL'); ?>">

<?php echo zen_href_link(FILENAME_ACCOUNT, '', 'SSL'); ?>">

<?php echo zen_href_link(FILENAME_LOGIN, '', 'SSL'); ?>

<?php echo zen_href_link(FILENAME_SHOPPING_CART, '', 'NONSSL'); ?>">

<?php echo zen_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'); ?>">


Form Function

zen_draw_form

Function Description: Construction of a form. function zen_draw_form ($ name, $ action, $ method = 'post', $ parameters = '')

 

 

PHP learning new function

basename

Function Description: Returns the filename component of path

 

Needs and questions

Language files loaded

Main language files loaded

Let remote image and native picture compatible

 

 

Published 110 original articles · won praise 3 · views 30000 +

Guess you like

Origin blog.csdn.net/yueyekonglong/article/details/104084921