Using include - works/doesn't work - See Example
Posted: Mon Aug 18, 2008 1:53 pm
Hello,
Dan here, n2tboard..
OK, this should be simple,
but makes ZERO sense to me.
I am going to link you to several identical files with different names.
All work and one doesn't.
I just can not believe that it works as long as the file name isn't "index.php"
LINKS:
menu.html sets a cookie that expires immediately for testing purposes.
The window with the yellow border should disappear in 20 seconds.
Forget about the POP-UP though, you can tell if it works or not, by scrolling down, if the menu follows (floats), then we are good..
Once in a while it will work, then I'll click "HOME" (which links to index.php) and then now menu, no pop-up.
Any ideas?
Does this ring a bell to anyone?
Thank you for any light you can shed on this.
include is on line 97
I know there may be some poor PHP here, but it works, all except for the different file names.
Dan here, n2tboard..
OK, this should be simple,
but makes ZERO sense to me.
I am going to link you to several identical files with different names.
All work and one doesn't.
I just can not believe that it works as long as the file name isn't "index.php"
LINKS:
- WORKS: index2.php
WORKS: indexYEAAA.php
WORKS: thisworks.php
WORKS: really.php
WORKS: whatToDoNow.php
DOES NOT WORK: index.php
menu.html sets a cookie that expires immediately for testing purposes.
The window with the yellow border should disappear in 20 seconds.
Forget about the POP-UP though, you can tell if it works or not, by scrolling down, if the menu follows (floats), then we are good..
Once in a while it will work, then I'll click "HOME" (which links to index.php) and then now menu, no pop-up.
Any ideas?
Does this ring a bell to anyone?
Thank you for any light you can shed on this.
include is on line 97
Code: Select all
<?php
//init variable for cache
if (isset($_REQUEST['grid']))
$grid = (int)$_REQUEST['grid'];
else
$grid = 1;
require_once('config.php');
require_once('grid.class.php');
//clean cache init
unset($grid);
// handle magnifier toggle
if (isset($_REQUEST['magnify'])) {
$_SESSION['magnify'] = !empty($_REQUEST['magnify']);
$args = array();
if (@$_REQUEST['grid'] > 1)
$args['grid'] = $_REQUEST['grid'];
$app->redirect(false, $args);
} else {
if (isset($_REQUEST['grid']))
$grid = (int)$_REQUEST['grid'];
else
$grid = 1;
}
// handle clickthrough
if (isset($_REQUEST['r'])) {
require_once('region.class.php');
$tbl = new Region;
$region = $tbl->get($_REQUEST['r'], false);
if (is_null($region->id()) || $region->status != REGION_ACTIVE)
$app->redirect();
if (empty($_SESSION['user_id']) && empty($_SESSION['is_admin'])) {
$region->clicks++;
$region->save();
$smarty->clear_all_cache(null, 'index|search');
}
header("Location: " . $region->url);
exit;
}
// process any region expiration events
require_once('util.class.php');
Util::process_expired_regions();
// fetch all the grids
$tbl = new Grid;
$grids = $tbl->find_all('order by display_order');
// make sure grid columns are >= 1
$c = max(1, $app->setting->grid_columns);
// if multiple grid pages are used, build links to the other pages, and then
// get only the requested grid
if ($app->setting->multiple_grid_pages) {
require_once('snippet.class.php');
$g =& $_REQUEST['grid'];
$g = max(1, $g);
$g = min(count($grids), $g);
$links = array();
for ($i = 0; $i < count($grids); $i++) {
$title = htmlspecialchars(Snippet::snippet_text('grid_title', $grids[$i]->id, '##Pixels##'));
if ($i == $g - 1)
$links[] = '<strong>' . $title . '</strong>';
else {
$params = array();
if ($i > 0)
$params = array('grid' => $i + 1);
$links[] = '<a href="' . htmlspecialchars($app->url(false, $params)) . '">' . $title . '</a>';
}
}
$smarty->assign('links', $links);
$grids = array($grids[$g - 1]);
$c = 1;
}
// arrange grids into rows/columns
$rows = array();
while (!empty($grids)) {
$row = array();
for ($i = 0; $i < $c; $i++) {
if (!empty($grids))
$row[] = array_shift($grids);
}
$rows[] = $row;
}
//get region ids for every grid
$rids_ids = $db->getCol('SELECT * FROM '.DB_PREFIX.'regions', 'id');
//$rids_ids
$smarty->assign('rids_ids', $rids_ids);
$smarty->assign('rows', $rows);
$smarty->display('index.tpl', 'index|'.(int)$_SESSION['magnify'].'|'.(int)$grid.'|'.$cache_id);
include ('menu.html');
?>