slimMenu Breaking Zen Cart - php
So this may be a shot in the dark but wondering if anyone smarter than I can tell me why the slimMenu breaks when I add these files to the bottom of the page.
<link href="includes/templates/westminster_new/css/age-verification.css" rel="stylesheet">
<script src="includes/templates/westminster_new/jscript/jquery-1.11.1.min.js"></script>
<script src="includes/templates/westminster_new/jscript/age-verification.js"></script>
<script src="includes/templates/westminster_new/jscript/jquery.cookie.min.js"></script>
This is the whole page:
<?php
/**
* Common Template
*
* outputs the html header. i,e, everything that comes before the \</head\> tag <br />
*
* #package templateSystem
* #copyright Copyright 2003-2014 Zen Cart Development Team
* #copyright Portions Copyright 2003 osCommerce
* #license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
* #version GIT: $Id: Author: DrByte Jul 5 2014 Modified in v1.5.4 $
* Altered by rbarbour (ZCAdditions.com), Responsive DIY Template Default for 1.5.x (65)
* Modified by Anne (Picaflor-Azul.com) Westminster New v1.3
*/
/**
* load the module for generating page meta-tags
*/
require(DIR_WS_MODULES . zen_get_module_directory('meta_tags.php'));
/**
* output main page HEAD tag and related headers/meta-tags, etc
*/
?>
<?php
// (BOF - 2.1) Responsive DIY Template Default for 1.5.x (65)
if (!class_exists('Mobile_Detect')) {
include_once(DIR_WS_CLASSES . 'Mobile_Detect.php');
$detect = new Mobile_Detect;
}
// (EOF - 2.1) Responsive DIY Template Default for 1.5.x (65)
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" <?php echo HTML_PARAMS; ?>>
<head>
<title><?php echo META_TAG_TITLE; ?></title>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>" />
<meta name="keywords" content="<?php echo META_TAG_KEYWORDS; ?>" />
<meta name="description" content="<?php echo META_TAG_DESCRIPTION; ?>" />
<meta http-equiv="imagetoolbar" content="no" />
<meta name="author" content="The Zen Cart® Team. Responsive zen cart design by Picaflor Azul. " />
<meta name="generator" content="shopping cart program by Zen Cart®, http://www.zen-cart.com eCommerce" />
<?php // (BOF - 2.1) Responsive DIY Template Default for 1.5.x (65) ?>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no" />
<?php // (EOF - 2.1) Responsive DIY Template Default for 1.5.x (65) ?>
<?php if (defined('ROBOTS_PAGES_TO_SKIP') && in_array($current_page_base,explode(",",constant('ROBOTS_PAGES_TO_SKIP'))) || $current_page_base=='down_for_maintenance' || $robotsNoIndex === true) { ?>
<meta name="robots" content="noindex, nofollow" />
<?php } ?>
<?php if (defined('FAVICON')) { ?>
<link rel="icon" href="<?php echo FAVICON; ?>" type="image/x-icon" />
<link rel="shortcut icon" href="<?php echo FAVICON; ?>" type="image/x-icon" />
<?php } //endif FAVICON ?>
<base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER . DIR_WS_HTTPS_CATALOG : HTTP_SERVER . DIR_WS_CATALOG ); ?>" />
<?php if (isset($canonicalLink) && $canonicalLink != '') { ?>
<link rel="canonical" href="<?php echo $canonicalLink; ?>" />
<?php } ?>
<?php
/**
* load all template-specific stylesheets, named like "style*.css", alphabetically
*/
$directory_array = $template->get_template_part($template->get_template_dir('.css',DIR_WS_TEMPLATE, $current_page_base,'css'), '/^style/', '.css');
while(list ($key, $value) = each($directory_array)) {
echo '<link rel="stylesheet" type="text/css" href="' . $template->get_template_dir('.css',DIR_WS_TEMPLATE, $current_page_base,'css') . '/' . $value . '" />'."\n";
}
/**
* load stylesheets on a per-page/per-language/per-product/per-manufacturer/per-category basis. Concept by Juxi Zoza.
*/
$manufacturers_id = (isset($_GET['manufacturers_id'])) ? $_GET['manufacturers_id'] : '';
$tmp_products_id = (isset($_GET['products_id'])) ? (int)$_GET['products_id'] : '';
$tmp_pagename = ($this_is_home_page) ? 'index_home' : $current_page_base;
if ($current_page_base == 'page' && isset($ezpage_id)) $tmp_pagename = $current_page_base . (int)$ezpage_id;
$sheets_array = array('/' . $_SESSION['language'] . '_stylesheet',
'/' . $tmp_pagename,
'/' . $_SESSION['language'] . '_' . $tmp_pagename,
'/c_' . $cPath,
'/' . $_SESSION['language'] . '_c_' . $cPath,
'/m_' . $manufacturers_id,
'/' . $_SESSION['language'] . '_m_' . (int)$manufacturers_id,
'/p_' . $tmp_products_id,
'/' . $_SESSION['language'] . '_p_' . $tmp_products_id
);
while(list ($key, $value) = each($sheets_array)) {
//echo "<!--looking for: $value-->\n";
$perpagefile = $template->get_template_dir('.css', DIR_WS_TEMPLATE, $current_page_base, 'css') . $value . '.css';
if (file_exists($perpagefile)) echo '<link rel="stylesheet" type="text/css" href="' . $perpagefile .'" />'."\n";
}
/**
* custom category handling for a parent and all its children ... works for any c_XX_XX_children.css where XX_XX is any parent category
*/
$tmp_cats = explode('_', $cPath);
$value = '';
foreach($tmp_cats as $val) {
$value .= $val;
$perpagefile = $template->get_template_dir('.css', DIR_WS_TEMPLATE, $current_page_base, 'css') . '/c_' . $value . '_children.css';
if (file_exists($perpagefile)) echo '<link rel="stylesheet" type="text/css" href="' . $perpagefile .'" />'."\n";
$perpagefile = $template->get_template_dir('.css', DIR_WS_TEMPLATE, $current_page_base, 'css') . '/' . $_SESSION['language'] . '_c_' . $value . '_children.css';
if (file_exists($perpagefile)) echo '<link rel="stylesheet" type="text/css" href="' . $perpagefile .'" />'."\n";
$value .= '_';
}
/**
* load printer-friendly stylesheets -- named like "print*.css", alphabetically
*/
$directory_array = $template->get_template_part($template->get_template_dir('.css',DIR_WS_TEMPLATE, $current_page_base,'css'), '/^print/', '.css');
sort($directory_array);
while(list ($key, $value) = each($directory_array)) {
echo '<link rel="stylesheet" type="text/css" media="print" href="' . $template->get_template_dir('.css',DIR_WS_TEMPLATE, $current_page_base,'css') . '/' . $value . '" />'."\n";
}
/**
* load all site-wide jscript_*.js files from includes/templates/YOURTEMPLATE/jscript, alphabetically
*/
$directory_array = $template->get_template_part($template->get_template_dir('.js',DIR_WS_TEMPLATE, $current_page_base,'jscript'), '/^jscript_/', '.js');
while(list ($key, $value) = each($directory_array)) {
echo '<script type="text/javascript" src="' . $template->get_template_dir('.js',DIR_WS_TEMPLATE, $current_page_base,'jscript') . '/' . $value . '"></script>'."\n";
}
/** CDN for jQuery core **/
?>
<script type="text/javascript">window.jQuery || document.write(unescape('%3Cscript type="text/javascript" src="//code.jquery.com/jquery-1.11.1.min.js"%3E%3C/script%3E'));</script>
<script type="text/javascript">window.jQuery || document.write(unescape('%3Cscript type="text/javascript" src="<?php echo $template->get_template_dir('.js',DIR_WS_TEMPLATE, $current_page_base,'jscript'); ?>/jquery.min.js"%3E%3C/script%3E'));</script>
<?php
/**
* load all page-specific jscript_*.js files from includes/modules/pages/PAGENAME, alphabetically
*/
$directory_array = $template->get_template_part($page_directory, '/^jscript_/', '.js');
while(list ($key, $value) = each($directory_array)) {
echo '<script type="text/javascript" src="' . $page_directory . '/' . $value . '"></script>' . "\n";
}
/**
* load all site-wide jscript_*.php files from includes/templates/YOURTEMPLATE/jscript, alphabetically
*/
$directory_array = $template->get_template_part($template->get_template_dir('.php',DIR_WS_TEMPLATE, $current_page_base,'jscript'), '/^jscript_/', '.php');
while(list ($key, $value) = each($directory_array)) {
/**
* include content from all site-wide jscript_*.php files from includes/templates/YOURTEMPLATE/jscript, alphabetically.
* These .PHP files can be manipulated by PHP when they're called, and are copied in-full to the browser page
*/
require($template->get_template_dir('.php',DIR_WS_TEMPLATE, $current_page_base,'jscript') . '/' . $value); echo "\n";
}
/**
* include content from all page-specific jscript_*.php files from includes/modules/pages/PAGENAME, alphabetically.
*/
$directory_array = $template->get_template_part($page_directory, '/^jscript_/');
while(list ($key, $value) = each($directory_array)) {
/**
* include content from all page-specific jscript_*.php files from includes/modules/pages/PAGENAME, alphabetically.
* These .PHP files can be manipulated by PHP when they're called, and are copied in-full to the browser page
*/
require($page_directory . '/' . $value); echo "\n";
}
// DEBUG: echo '<!-- I SEE cat: ' . $current_category_id . ' || vs cpath: ' . $cPath . ' || page: ' . $current_page . ' || template: ' . $current_template . ' || main = ' . ($this_is_home_page ? 'YES' : 'NO') . ' -->';
// (BOF - 2.1) Responsive DIY Template Default for 1.5.x (65)
if (COLUMN_WIDTH == '0' || (in_array($current_page_base,explode(",",'popup_image,popup_image_additional')) )) {
echo '';
} else {
$responsive_mobile = '<link rel="stylesheet" type="text/css" href="' . $template->get_template_dir('.css',DIR_WS_TEMPLATE, $current_page_base,'css') . '/' . 'responsive_mobile.css' . '" />';
require($template->get_template_dir('responsive_mobile.php',DIR_WS_TEMPLATE, $current_page_base,'common'). '/responsive_mobile.php');
$responsive_tablet = '<link rel="stylesheet" type="text/css" href="' . $template->get_template_dir('.css',DIR_WS_TEMPLATE, $current_page_base,'css') . '/' . 'responsive_tablet.css' . '" />';
require($template->get_template_dir('responsive_tablet.php',DIR_WS_TEMPLATE, $current_page_base,'common'). '/responsive_tablet.php');
$responsive_default = '<link rel="stylesheet" type="text/css" href="' . $template->get_template_dir('.css',DIR_WS_TEMPLATE, $current_page_base,'css') . '/' . 'responsive_default.css' . '" />';
echo '<link rel="stylesheet" type="text/css" href="' . $template->get_template_dir('.css',DIR_WS_TEMPLATE, $current_page_base,'css') . '/' . 'responsive.css' . '" />';
if ($detect->isMobile() && !$detect->isTablet() or $detect->isMobile() && !$detect->isTablet() && $_SESSION['display_mode']=='isMobile' or $detect->isTablet() && $_SESSION['display_mode']=='isMobile' or $_SESSION['display_mode']=='isMobile') {
echo $responsive_mobile;
} else if ($detect->isTablet() or $detect->isMobile() && $_SESSION['display_mode']=='isTablet' or $detect->isTablet() && $_SESSION['display_mode']=='isTablet' or $_SESSION['display_mode']=='isTablet'){
echo $responsive_tablet;
} else if ($detect->isMobile() && !$detect->isTablet() && $_SESSION['display_mode']=='isDesktop' or $detect->isTablet() && $_SESSION['display_mode']=='isDesktop' or $_SESSION['display_mode']=='isNonResponsive'){
echo '';
} else {
echo $responsive_default;
}
}
if($detect->isMobile() && !$detect->isTablet() && $_SESSION['display_mode']=='isDesktop' or $detect->isTablet() && $_SESSION['display_mode']=='isDesktop' or $detect->isMobile() && !$detect->isTablet() && $_SESSION['display_mode']=='isNonResponsive' or $detect->isTablet() && $_SESSION['display_mode']=='isNonResponsive' or $_SESSION['display_mode']=='isNonResponsive'){
$fluidisFixed = 'fluidIsFixed';
} else {
$fluidisFixed = '';
}
// (EOF - 2.1) Responsive DIY Template Default for 1.5.x (65)
?>
<script src="<?php echo $template->get_template_dir('',DIR_WS_TEMPLATE, $current_page_base,'jscript') . '/css_browser_selector.js' ?>" type="text/javascript"></script>
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css" rel="stylesheet" />
<link href="includes/templates/westminster_new/css/age-verification.css" rel="stylesheet">
<script src="includes/templates/westminster_new/jscript/jquery-1.11.1.min.js"></script>
<script src="includes/templates/westminster_new/jscript/age-verification.js"></script>
<script src="includes/templates/westminster_new/jscript/jquery.cookie.min.js"></script>
</head>
<?php // NOTE: Blank line following is intended: ?>
Looks like jquery is being included twice as ZC loads it above the new lines you're adding.
Related
The dynamic tabs are presenting the same records
I am trying to create a dynamic tab with PHP and MySQL using Bootstrap Framework for the movie website that I am creating. The movies will be segregated into Now Showing and Coming Soon. Expected Result: The movies should be displayed based on the category (Now Showing or Coming Soon). Actual Result: The dynamic tab is not working. Movies that are under “Coming Soon” are displayed in “Now Showing”. In addition, the website only displays 2nd record onwards (from the database). The first record for “Now Showing” which is theand “Coming Soon” are not displayed. The same content is displayed regardless of clicking “Now Showing” or “Coming Soon” tab (The “Coming Soon” tab can only be seen if I hover which is another issue that I need to fix). The movie 'The cursed lesson' should be shown in Coming Soon. The first record for 'Now Showing' and 'Coming Soon' are not shown. I truly appreciate your help and advice in fixing these problems. I have been trying to solve these for days but I just can't seem to figure it out. Here are my codes: <?php $servername = 'localhost'; $username = 'root'; $password = ''; $dbname = 'movie'; $conn = new mysqli($servername, $username, $password, $dbname); $tab_query = "SELECT * FROM category ORDER BY Category_ID"; $tab_result = mysqli_query($conn, $tab_query); $tab_menu = ''; $tab_content = ''; $count = 0; while ($row = mysqli_fetch_array($tab_result)) { if ($count == 0) { $tab_menu .= '<li class="nav-item"><a class="nav-link active" href="#' . $row["Category_ID"] . '" data-toggle="tab">' . $row["Category_Name"] . '</a></li>'; $tab_content .= '<div id="'.$row["Category_ID"].'" class="tab-pane fade in active"'; } else { $tab_menu .= '<li class="nav-item"><a class="nav-link" href="#' . $row["Category_ID"] . '" data-toggle="tab">' . $row["Category_Name"] . '</a></li>'; $tab_content .= '<div id="'.$row["Category_ID"].'" class="tab-pane fade"'; } $product_query = "SELECT * FROM movie WHERE Category_ID = '".$row["Category_ID"]."'"; $product_result = mysqli_query($conn, $product_query); while($sub_row = mysqli_fetch_array($product_result)) { $tab_content .= ' <div class="col-md-3" style="margin-bottom:36px;"> <img src="'.$sub_row["Image_URL"].'" class="img-responsive img-thumbnail" /> <h4>'.$sub_row["Title"].'</h4> </div> '; } $tab_content .= '<div style="clear:both"></div></div>'; $count++; } ?> <!DOCTYPE html> <html> <head> <title>Movie Testing Website</title> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0, shrink-to-fit=no"> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <meta name="HandheldFriendly" content="true"> <!--Bootstrap CSS--> <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity= "sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh"crossorigin="anonymous"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css"> <!--Custom CSS--> <link rel="stylesheet" href="css/main.css"> <!--jQuery--> <script defer src="https://code.jquery.com/jquery-3.4.1.min.js" integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script> <!--Bootstrap JS--> <script defer src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.bundle.min.js" integrity="sha384-6khuMg9gaYr5AxOqhkVIODVIvm9ynTT5J4V1cfthmT+emCG6yVmEZsRHdxlotUnm" crossorigin="anonymous"></script> <script defer src="js/main.js"></script> </head> <body> <div class="container"> <ul class="nav nav-tabs"> <?php echo $tab_menu; ?> </ul> <div class="tab-content"> <?php echo $tab_content; ?> </div> </div> </body> </html> Here are snippets of my database: Movie Table: Category Table:
I was found the problem in the view and not in data collection from db. I modified the html structure based on this sample: https://bootsnipp.com/snippets/exE6D Find out more about Bootstrap tab navigations: https://www.w3schools.com/bootstrap4/bootstrap_navs.asp <?php $servername = 'localhost'; $username = 'root'; $password = ''; $dbname = 'movie'; $conn = new mysqli($servername, $username, $password, $dbname); $tab_query = "SELECT * FROM category ORDER BY Category_ID"; $tab_result = mysqli_query($conn, $tab_query); $tab_menu = ''; $tab_content = ''; $count = 0; while ($row = mysqli_fetch_array($tab_result)) { if ($count == 0) { $tab_menu .= '<a class="nav-item nav-link active" id="' . $row["Category_ID"] . '" data-toggle="tab" href="#nav-' . $row["Category_ID"] . '" role="tab" aria-controls="nav-' . $row["Category_ID"] . '" aria-selected="true">' . $row["Category_Name"] . '</a>'; $tab_content .= '<div class="tab-pane fade show active" id="nav-' . $row["Category_ID"] . '" role="tabpanel" aria-labelledby="nav-' . $row["Category_ID"] . '-tab">'; } else { $tab_menu .= '<a class="nav-item nav-link" id="' . $row["Category_ID"] . '" data-toggle="tab" href="#nav-' . $row["Category_ID"] . '" role="tab" aria-controls="nav-' . $row["Category_ID"] . '" aria-selected="false">' . $row["Category_Name"] . '</a>'; $tab_content .= '<div class="tab-pane fade show" id="nav-' . $row["Category_ID"] . '" role="tabpanel" aria-labelledby="nav-' . $row["Category_ID"] . '-tab">'; } $product_query = "SELECT * FROM movie WHERE Category_ID = '".$row["Category_ID"]."'"; $product_result = mysqli_query($conn, $product_query); while($sub_row = mysqli_fetch_array($product_result)) { $tab_content .= ' <div class="col-md-3" style="margin-bottom:36px;"> <img src="'.$sub_row["Image_URL"].'" class="img-responsive img-thumbnail" /> <h4>'.$sub_row["Title"].'</h4> </div>'; } $tab_content .= '<div style="clear:both"></div></div>'; $count++; } ?> <!DOCTYPE html> <html> <head> <title>Movie Testing Website</title> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0, shrink-to-fit=no"> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <meta name="HandheldFriendly" content="true"> <!--Bootstrap CSS--> <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh"crossorigin="anonymous"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css"> <!--Custom CSS--> <link rel="stylesheet" href="css/main.css"> <!--jQuery--> <script defer src="https://code.jquery.com/jquery-3.4.1.min.js" integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script> <!--Bootstrap JS--> <script defer src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.bundle.min.js" integrity="sha384-6khuMg9gaYr5AxOqhkVIODVIvm9ynTT5J4V1cfthmT+emCG6yVmEZsRHdxlotUnm" crossorigin="anonymous"></script> <script defer src="js/main.js"></script> </head> <body> <div class="container"> <div class="row"> <div class="col-xs-12 "> <nav> <div class="nav nav-tabs nav-fill" id="nav-tab" role="tablist"> <?php echo $tab_menu; ?> </div> </nav> <div class="tab-content py-3 px-3 px-sm-0" id="nav-tabContent"> <?php echo $tab_content; ?> </div> </div> </div> </div> </body> </html>
Absolute File paths with Stylesheets CSS
Can anyone please tell me why the below will not and output the absolute filepath <link rel="stylesheet" type="text/css" href=" <?php 'http://' . $_SERVER['HTTP_HOST'] . '/styles/styles.css'; ?> " /> I'm trying to create a constant link
you forgot to echo <link rel="stylesheet" type="text/css" href=" <?php echo 'http://' . $_SERVER['HTTP_HOST'] . '/styles/styles.css'; ?> " />
How to wrap html when running foreach loop
i have a loop like this below foreach( $b as $entry) { $title2 = "<!doctype html> <meta content='text/html; charset=UTF-8' http-equiv='Content-Type'> <head> <link rel='stylesheet' href='../../css/bootstrap.min.css'> </head> <body>"; $title2 .= "<div class='data'><div id=".$id."><span style='font-family: Web'>".$entry->pubDate." </span><a href='../../fetch.php?url=".$id."' title='$entry->title' >" .$title. "</a><br/><div class='content'>".$description."</div></div></div>"; $title3 = "<!doctype html> <meta content='text/html; charset=UTF-8' http-equiv='Content-Type'> <meta name='viewport' content='width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;'> <head> <link rel='stylesheet' href='../../../css/bootstrap.min.css'> </head> <body><div class='container'> <div class='row'> <div class='col-lg-12' style='margin-top:20px;'>"; $title3 .= "<div class='list-group'><span style='font-family: Malithi Web'>".$entry->pubDate." </span>'<div><h4 class='list-group-item-heading'>'" .$title. "</h4></div><br/></div></div></div></div></div></div></div>"; if (!file_exists('File')) { mkdir('File', 0777, true); } if (!file_exists('./File/'.date("Y-m-d"))) { mkdir('./File/'.date("Y-m-d"), 0777, true); } if (!file_exists('./File/titles/'.date("Y-m-d"))) { mkdir('./File/titles/'.date("Y-m-d"), 0777, true); } $File = './File/'.date("Y-m-d").'/'."File.html"; file_put_contents($File, $title2, FILE_APPEND | LOCK_EX); $FileT = './File2/titles/'.date("Y-m-d").'/'."File2.html"; file_put_contents($FileT, $title3, FILE_APPEND | LOCK_EX); }//foreach end When i save the file what i want is to save it with html head and styles..but now it is saving for each time when the loop runs..i want it for just run once. Thank you!
Do you want to have two dayly log files with the same data but differently formatted? Then move your header , footer and filenaming logic outside of your loop. <?php foreach ($b as $entry) { $body2 .= "<div class='data'><div id=" . $id . "><span style='font-family: Web'>" . $entry->pubDate . " </span><a href='../../fetch.php?url=" . $id . "' title='$entry->title' >" . $title . "</a><br/><div class='content'>" . $description . "</div></div></div>"; $body3 .= "<div class='list-group'><span style='font-family: Malithi Web'>" . $entry->pubDate . " </span>'<div><h4 class='list-group-item-heading'>'" . $title . "</h4></div><br/></div></div></div></div></div></div></div>"; } if (!file_exists('File')) { mkdir('File', 0777, true); } if (!file_exists('./File/' . date("Y-m-d"))) { mkdir('./File/' . date("Y-m-d"), 0777, true); } if (!file_exists('./File/titles/' . date("Y-m-d"))) { mkdir('./File/titles/' . date("Y-m-d"), 0777, true); } $File = './File/' . date("Y-m-d") . '/' . "File.html"; $title2 = "<!doctype html> <meta content='text/html; charset=UTF-8' http-equiv='Content-Type'> <head> <link rel='stylesheet' href='../../css/bootstrap.min.css'> </head> <body>"; $footer2 = "</body></html>"; file_put_contents($File, $title2 . $body2 . $footer2, FILE_APPEND | LOCK_EX); $title3 = "<!doctype html> <meta content='text/html; charset=UTF-8' http-equiv='Content-Type'> <meta name='viewport' content='width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;'> <head> <link rel='stylesheet' href='../../../css/bootstrap.min.css'> </head> <body><div class='container'> <div class='row'> <div class='col-lg-12' style='margin-top:20px;'>"; $footer3 = "</div></div></div></body></html>"; $FileT = './File2/titles/' . date("Y-m-d") . '/' . "File2.html"; file_put_contents($FileT, $title3 . $body3 . $footer3, FILE_APPEND | LOCK_EX);
Prestashop / Smarty Template converting to standard php
Im trying to convert a prestashop theme into a wordpress theme and im having issues understanding the smarty template lingo. I was wondering if someone could tell me in standard php syntax what the following means. {if isset($css_files)} {foreach from=$css_files key=css_uri item=media} {if preg_match("#global#",$css_uri)} <link rel="stylesheet" href="{$css_uri|escape:'html':'UTF-8'}" id="global-style" type="text/css" media="{$media|escape:'html':'UTF-8'}" /> {else} <link rel="stylesheet" href="{$css_uri|escape:'html':'UTF-8'}" type="text/css" media="{$media|escape:'html':'UTF-8'}" /> {/if} {/foreach} {/if} Any help would be greatly appreciated. Cheers,
if (isset($css_files)) { foreach ($css_files as $css_uri => $media) { if (preg_match("#global#", $css_uri)) { echo '<link rel="stylesheet" href="' . htmlspecialchars($css_uri, ENT_QUOTES, 'UTF-8') . '" id="global-style" type="text/css" media="' . htmlspecialchars($media, ENT_QUOTES, 'UTF-8') . '" />'; } else { echo '<link rel="stylesheet" href="' . htmlspecialchars($css_uri, ENT_QUOTES, 'UTF-8') . '" type="text/css" media="' . htmlspecialchars($media, ENT_QUOTES, 'UTF-8') . '" />'; } } }
Loading is_file not working in codeigniter
Currently I am trying to load file by a data array in codeigniter. But the is file not picking it up. I can not echo my logo to the view page What is the best way to get it like below so I can get images as an array. public function index() { if (is_file(dirname(FCPATH) . '/image/data/logo.png')) { $data['logo'] = dirname(FCPATH) . '/image/' . 'data/logo.png'; } else { $data['logo'] = ''; } $this->load->view('theme/default/template/common/header', $data); } Tried all ready <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); class Header extends MX_Controller { public function index() { //$this->load->library('document'); if (is_file(FCPATH) . 'image\data\logo.png') { $data['logo'] = FCPATH . 'image\data\logo.png'; } else { $data['logo'] = ''; } $this->load->view('theme/default/template/common/header', $data); } } View Header File <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title><?php echo $title;?></title> <link rel="stylesheet" href="catalog/views/theme/default/stylesheet/stylesheet.css"> <link rel="stylesheet" href="catalog/views/theme/default/stylesheet/bootstrap.css"> <link href="//netdna.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css" rel="stylesheet"> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> </head> <body> <div class="container"> <div class="row"> <div class="col-lg-3 col-md-3 col-sm-3 col-xs-12"> <div class="thumbnail"> <img src="<?php echo $logo;?>" class="img-responsive"> </div> </div> </div> </div>
try to change FCPATH to base_url() in your header controller file... it works!! if (is_file(base_url()) . 'image/data/logo.png') { $data['logo'] = base_url() . 'image/data/logo.png'; } else { $data['logo'] = ''; }
public function index() { if (is_file(FCPATH) . 'image\data\logo.png') { $data['logo'] = FCPATH . 'image\data\logo.png'; } else { $data['logo'] = ''; } $this->load->view('theme/default/template/common/header', $data); } put this.. in your header file put this "<img src="<?php echo $logo; ?>";