Added menopause solutions changed out some hardcoded paths finally.
git-svn-id: http://svn.cleancode.org/svn/pickles@47 4d10bc64-7434-11dc-a737-d2d0f8310089
This commit is contained in:
parent
49eb0f7087
commit
3116e320d0
7 changed files with 46 additions and 17 deletions
|
@ -1,16 +1,18 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
date_default_timezone_set('America/New_York');
|
date_default_timezone_set('America/New_York');
|
||||||
define('PATH', getcwd() . '/');
|
|
||||||
|
define('PICKLES_PATH', getcwd() . '/../../pickles/');
|
||||||
|
define('TEMP_PATH', '/tmp/smarty/' . $_SERVER['SERVER_NAME'] . '/');
|
||||||
|
|
||||||
function __autoload($class) {
|
function __autoload($class) {
|
||||||
$file = PATH . '../../pickles/classes/' . str_replace('_', '/', $class) . '.php';
|
$file = PICKLES_PATH . 'classes/' . str_replace('_', '/', $class) . '.php';
|
||||||
|
|
||||||
if (file_exists($file)) {
|
if (file_exists($file)) {
|
||||||
require_once $file;
|
require_once $file;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$file = PATH . '../../pickles/models/' . str_replace('_', '/', $class) . '.php';
|
$file = PICKLES_PATH . 'models/' . str_replace('_', '/', $class) . '.php';
|
||||||
|
|
||||||
if (file_exists($file)) {
|
if (file_exists($file)) {
|
||||||
require_once $file;
|
require_once $file;
|
||||||
|
|
|
@ -25,8 +25,7 @@ class Config extends Singleton {
|
||||||
|
|
||||||
public function load($site) {
|
public function load($site) {
|
||||||
if (!isset($this->file) || filemtime($this->file) > $this->timestamp) {
|
if (!isset($this->file) || filemtime($this->file) > $this->timestamp) {
|
||||||
// @todo no hardcoded paths!
|
$file = PICKLES_PATH . 'config/' . $site . '.xml';
|
||||||
$file = '/var/www/josh/pickles/config/' . $site . '.xml';
|
|
||||||
|
|
||||||
if (file_exists($file)) {
|
if (file_exists($file)) {
|
||||||
$this->file = $file;
|
$this->file = $file;
|
||||||
|
|
|
@ -24,9 +24,8 @@ class Viewer_Smarty extends Viewer_Common {
|
||||||
$smarty->template_dir = '../templates/';
|
$smarty->template_dir = '../templates/';
|
||||||
|
|
||||||
// @todo instead of having this in /tmp (which is Linux-scentric) perhaps move it to a folder in the common dir
|
// @todo instead of having this in /tmp (which is Linux-scentric) perhaps move it to a folder in the common dir
|
||||||
$temp_path = "/tmp/smarty/{$_SERVER['SERVER_NAME']}/";
|
$cache_dir = TEMP_PATH . 'cache';
|
||||||
$cache_dir = $temp_path . 'cache';
|
$compile_dir = TEMP_PATH . 'compile';
|
||||||
$compile_dir = $temp_path . 'compile';
|
|
||||||
|
|
||||||
if (!file_exists($cache_dir)) { mkdir($cache_dir, 0777, true); }
|
if (!file_exists($cache_dir)) { mkdir($cache_dir, 0777, true); }
|
||||||
if (!file_exists($compile_dir)) { mkdir($compile_dir, 0777, true); }
|
if (!file_exists($compile_dir)) { mkdir($compile_dir, 0777, true); }
|
||||||
|
@ -38,7 +37,7 @@ class Viewer_Smarty extends Viewer_Common {
|
||||||
|
|
||||||
// Include custom Smarty functions
|
// Include custom Smarty functions
|
||||||
// @todo Stupid fucking hard coded path
|
// @todo Stupid fucking hard coded path
|
||||||
$directory = PATH . '../../pickles/smarty/functions/';
|
$directory = PICKLES_PATH . 'smarty/functions/';
|
||||||
|
|
||||||
if (is_dir($directory)) {
|
if (is_dir($directory)) {
|
||||||
if ($handle = opendir($directory)) {
|
if ($handle = opendir($directory)) {
|
||||||
|
|
22
config/menopausesolutions.net.xml
Executable file
22
config/menopausesolutions.net.xml
Executable file
|
@ -0,0 +1,22 @@
|
||||||
|
<config>
|
||||||
|
<database>
|
||||||
|
<hostname>localhost</hostname>
|
||||||
|
<username>ribbonnutritio</username>
|
||||||
|
<password>XrP5DZbZ</password>
|
||||||
|
<database>ribbonnutrition_com_-_storelocator</database>
|
||||||
|
</database>
|
||||||
|
<navigation>
|
||||||
|
<default>home</default>
|
||||||
|
<sections>
|
||||||
|
<home>Home</home>
|
||||||
|
<products>Products and Formula</products>
|
||||||
|
<contact>Retail Locator and Contact</contact>
|
||||||
|
</sections>
|
||||||
|
</navigation>
|
||||||
|
<contact>
|
||||||
|
<prefix>MenoSol</prefix>
|
||||||
|
<recipients>
|
||||||
|
<recipient>joshsherman@gmail.com</recipient>
|
||||||
|
</recipients>
|
||||||
|
</contact>
|
||||||
|
</config>
|
|
@ -10,10 +10,16 @@ class store extends Model {
|
||||||
$this->data['subnav'] = $config->get('store', 'sections');
|
$this->data['subnav'] = $config->get('store', 'sections');
|
||||||
|
|
||||||
// Loads the categories
|
// Loads the categories
|
||||||
$categories = $this->db->getArray('SELECT id, name FROM categories WHERE parent_id IS NULL AND visible = "Y" ORDER BY weight;');
|
$categories = $this->db->getArray('SELECT id, name, permalink FROM categories WHERE parent_id IS NULL AND visible = "Y" ORDER BY weight;');
|
||||||
if (is_array($categories)) {
|
if (is_array($categories)) {
|
||||||
foreach ($categories as $key => $category) {
|
foreach ($categories as $key => $category) {
|
||||||
$categories[$key]['subcategories'] = $this->db->getArray('SELECT id, name FROM categories WHERE parent_id = "' . $category['id'] . '" AND visible = "Y" ORDER BY weight;');
|
$categories[$key]['subcategories'] = $this->db->getArray('
|
||||||
|
SELECT id, name, permalink
|
||||||
|
FROM categories
|
||||||
|
WHERE parent_id = "' . $category['id'] . '"
|
||||||
|
AND visible = "Y"
|
||||||
|
ORDER BY weight;
|
||||||
|
');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,12 @@
|
||||||
<div id="store-categories">
|
<div id="store-categories">
|
||||||
{foreach from=$categories item=category}
|
{foreach from=$categories item=parent_category}
|
||||||
<div id="{$category.name|lower|replace:' ':'-'}">
|
<div id="{$parent_category.permalink}">
|
||||||
<h1 id="">{$category.name}</h1>
|
<h1>{$parent_category.name}</h1>
|
||||||
</div>
|
</div>
|
||||||
<ul>
|
<ul>
|
||||||
{foreach from=$category.subcategories item=subcategory}
|
{foreach from=$parent_category.subcategories item=subcategory}
|
||||||
<li><a href="/store/category/{$subcategory.name|regex_replace:'/&[a-z]+;/':''|replace:' ':' '|strip_tags:false|lower|replace:' ':'-'}">{$subcategory.name}</a></li>
|
<!--li><a href="/store/category/{$subcategory.name|regex_replace:'/&[a-z]+;/':''|replace:' ':' '|strip_tags:false|lower|replace:' ':'-'}">{$subcategory.name}</a></li-->
|
||||||
|
<li {if $subcategory.name == $category.name}class="selected"{/if}><a href="/store/category/{$subcategory.permalink}">{$subcategory.name}</a></li>
|
||||||
{/foreach}
|
{/foreach}
|
||||||
</ul><br />
|
</ul><br />
|
||||||
{/foreach}
|
{/foreach}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<div id="store-subnav">
|
<div id="store-subnav">
|
||||||
<ol id="subnav">
|
<ol id="subnav">
|
||||||
{foreach from=$subnav key=link item=label}
|
{foreach from=$subnav key=link item=label}
|
||||||
<li {if $model == 'store/'|cat:$link}class="selected"{/if}><a href="/{$section}/{$link}">{$label}</a></li>
|
<li {if $model == 'store/'|cat:$link}class="selected"{/if}><a href="/{$section}/{$link}" class="{$link}">{$label}</a></li>
|
||||||
{/foreach}
|
{/foreach}
|
||||||
</ol>
|
</ol>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue