当前位置: 首页>>代码示例>>PHP>>正文


PHP modX::runSnippet方法代码示例

本文整理汇总了PHP中modX::runSnippet方法的典型用法代码示例。如果您正苦于以下问题:PHP modX::runSnippet方法的具体用法?PHP modX::runSnippet怎么用?PHP modX::runSnippet使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在modX的用法示例。


在下文中一共展示了modX::runSnippet方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: redirectToFirst

 /**
  * Redirect user to the first page of pagination
  *
  * @param $isAjax
  *
  * @return string
  */
 public function redirectToFirst($isAjax = false)
 {
     unset($_GET[$this->pdoTools->config['pageVarKey']]);
     unset($_GET[$this->modx->getOption('request_param_alias', null, 'q')]);
     if (!$isAjax) {
         $this->modx->sendRedirect($this->modx->makeUrl($this->modx->resource->id, $this->modx->context->key, $_GET, 'full'));
         return '';
     } else {
         $_GET[$this->pdoTools->config['pageVarKey']] = 1;
         $_REQUEST = $_GET;
         return $this->modx->runSnippet('pdoPage', $this->pdoTools->config);
     }
 }
开发者ID:Jako,项目名称:pdoTools,代码行数:20,代码来源:pdopage.class.php

示例2: modX

<?php

require_once '../../../core/config/config.inc.php';
require_once MODX_CORE_PATH . 'model/modx/modx.class.php';
$modx = new modX();
$modx->initialize('mgr');
$modx->getService('error', 'error.modError', '', '');
set_include_path(MODX_CORE_PATH . '../php/');
require_once 'lib/testing/assert_extension.php';
$result = $modx->runSnippet('getGalAlbumIdsByName', array('name' => 11));
$total = sizeof($result);
assert('$total == 0', 'getGalAlbumIdsByName :: Просто число вместо имени.');
//----------------------------------------------------------------------------
$result = $modx->runSnippet('getGalAlbumIdsByName', array('name' => 'wrong name'));
$total = sizeof($result);
assert('$total == 0', 'getGalAlbumIdsByName :: Нет такого имени альбома.');
//----------------------------------------------------------------------------
$result = $modx->runSnippet('getGalAlbumIdsByName', array('name' => 'test1'));
$total = sizeof($result);
$id = $result[0];
assert('$total == 2', 'getGalAlbumIdsByName :: Два альбома с один именем.');
assert('($id == 4)||($id == 5)', 'getGalAlbumIdsByName :: id альбомов 4 и 5.');
//----------------------------------------------------------------------------
$result = $modx->runSnippet('getGalAlbumIdsByName', array('name' => 'test2'));
$total = sizeof($result);
$id = $result[0];
assert('$total == 1', 'getGalAlbumIdsByName :: Только 1 альбом.');
assert('$id == 7', 'getGalAlbumIdsByName :: id альбома 7.');
//----------------------------------------------------------------------------
if ($errors_total == 0) {
    echo 'All tests passed.';
开发者ID:reksar,项目名称:php_trash,代码行数:31,代码来源:getGalAlbumIdsByName_test.php

示例3: checkAuth

 /**
  * Runs snippet that checks permission of user to upload files
  *
  * @return bool|string
  */
 function checkAuth()
 {
     return !empty($this->config['authSnippet']) ? $this->modx->runSnippet($this->config['authSnippet'], $this->config) : true;
 }
开发者ID:bendasvadim,项目名称:modx-uploadify,代码行数:9,代码来源:uploadify.class.php

示例4: tagManagerBase

$modx->resource = $modx->getObject('modResource', $criteria);
if (!is_object($modx->resource) || !$modx->resource->checkPolicy('view')) {
    echo json_encode($output);
    exit;
}
$modx->resourceIdentifier = $modx->resource->get('id');
$modx->getService('error', 'error.modError');
$modx->getRequest();
$modx->getParser();
$modx->resourceMethod = 'id';
$modx->resource->_contextKey = $modx->context->get('key');
$modx->invokeEvent('OnLoadWebDocument');
require_once MODX_CORE_PATH . "components/tag_manager2/model/tm_base.class.php";
$tag_manager = new tagManagerBase($modx);
$properties = $tag_manager->getSnippetProperties();
$output['prod_list'] = $modx->runSnippet('tmCatalog', $properties);
$output['prod_list'] .= '<div class="clearfix"></div>';
$output['onPageLimit'] = intval($properties['limit']);
if (isset($modx->placeholders[$properties['pageNavVar']])) {
    $output['pages'] = $modx->placeholders[$properties['pageNavVar']];
    if (isset($modx->sanitizePatterns['tags1'])) {
        $output['pages'] = preg_replace($modx->sanitizePatterns['tags1'], '', $output['pages']);
    }
    if (isset($modx->sanitizePatterns['tags2'])) {
        $output['pages'] = preg_replace($modx->sanitizePatterns['tags2'], '', $output['pages']);
    }
}
if (isset($modx->placeholders['pageCount'])) {
    $output['pageCount'] = $modx->placeholders['pageCount'];
}
if (isset($modx->placeholders[$properties['totalVar']])) {
开发者ID:MobiTeam,项目名称:mirfoto,代码行数:31,代码来源:ajax_resources.php

示例5: define

        /* be sure this has a trailing slash */
        define('MODX_CORE_PATH', dirname(dirname(dirname(dirname(__FILE__)))) . '/');
    }
    /* get the MODX class file */
    require_once MODX_CORE_PATH . 'model/modx/modx.class.php';
    /* instantiate the $modx object */
    $modx = new modX();
    if (!$modx || !$modx instanceof modX) {
        echo 'Could not create MODX class';
    }
    /* initialize MODX and set current context */
    $modx->initialize('web');
    /* load the error handler */
    $modx->getService('error', 'error.modError', '', '');
    /* Set up logging */
    $modx->setLogLevel(xPDO::LOG_LEVEL_INFO);
    /* Set log target */
    $modx->setLogTarget('ECHO');
    // Is CronJob allowed?
    if ($modx->getOption($pkg . '.use_cronjob') && $modx->getOption($pkg . '.activated') && $modx->getOption($pkg . '.seofriendly')) {
        // Clear Cache
        //$cm = $modx->getCacheManager();
        //$cm->refresh();
        // Run Import Snippet - Cached Version
        $modx->runSnippet($pkg . '_import', array());
        exit(1);
    }
    exit(0);
}
echo 'This is an command line script for cronjobs';
exit(0);
开发者ID:alaingab,项目名称:modx,代码行数:31,代码来源:ludwigdisqus_cronjob.php


注:本文中的modX::runSnippet方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。