
Ivan Ivković
Members-
Posts
139 -
Joined
-
Last visited
Never
Profile Information
-
Gender
Not Telling
Ivan Ivković's Achievements

Member (2/5)
0
Reputation
-
Generated JS and CSS by PHP not working?
Ivan Ivković replied to Ivan Ivković's topic in PHP Coding Help
It's ok now thanks. -
http://pixpresso.mycyberlove.com/ This is the URL. Code in dynamic_src: <?php $p = realpath(dirname(__FILE__)); define('ROOT_SITE_PATH', $p); include(ROOT_SITE_PATH . '/includes/functions.php'); # Global functions. include(ROOT_SITE_PATH. '/includes/init.php'); # Page constants, includes for the app 'n stuff. $init = new Init(); unset($init); if(isset($_GET['file'])){ $file_ext = substr(strrchr($_GET['file'],'.'),1); $file_name = preg_replace('/\.[^.]*$/', '', $_GET['file']); switch(strtolower($file_ext)){ case 'css': header('Content-Type: text/css; charset: UTF-8;'); $file = DIR_STYLES . $file_name . '.php'; if(is_file($file)){ include($file); } break; case 'js': header('Content-Type: application/x-javascript; charset: UTF-8;'); $file = DIR_SCRIPTS . $file_name . '.php'; if(is_file($file)){ include($file); } break; } }else{ die(header('Location: ' . WEB_PATH)); } Code to call it: <script type="text/javascript" src="http://pixpresso.mycyberlove.com/dynamic_src.php?file=nav_scroll.js"></script> <link rel="stylesheet" type="text/css" src="http://pixpresso.mycyberlove.com/dynamic_src.php?file=popups.css"/> Output working! But browser doesn't read it as CSS for some reason? Output in http://pixpresso.mycyberlove.com/dynamic_src.php?file=main.css : body{ margin: 0; text-align: center; overflow-x: hidden; background-color: #f7f7f7; background: url(/src/images/image_background.png); background-repeat: repeat; } *{ font-family: "tahoma",lucida grande,verdana,arial,sans-serif; color: #666; text-shadow: white 0 1px 0; } h4, h5, h6{ font-weight: 300; padding: 0; margin: 0; } img{ border: 0; } .element{ /*background-color: white; border: 1px solid #dadada;*/ /*-moz-box-shadow: 0 0 7px #333; -webkit-box-shadow: 0 0 7px#333; box-shadow: 0 0 7px #333; */ } a{ text-decoration: none; } #background{ position: fixed; top: -50px; left: -50px; width: 150%; height: 150%; background-color: #000; z-index: 99998; display: none; } #background2{ position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: #222; z-index: 99980; display: none; } .popup{ position: fixed; left: 50%; top: 50%; background-color: #e5e5e5; z-index: 99999; -moz-box-shadow: 0 0 80px #000; -webkit-box-shadow: 0 0 80px #000; box-shadow: 0 0 80px #333; display: none; border-radius: 4px; } .data{ display: none; } .hidden{ position: absolute; left: -10000px; width: 0; padding: 0; margin: 0; } #warning{ position: relative; top: 90px; border: 1px solid #999; left: 4px; width: 99%; padding: 10px 0px; color: #666; background-color: #e6e6e6; } #warning2{ position: relative; top: 290px; border: 1px solid #555; left: 4px; width: 99%; padding: 10px 0px; color: #444; background-color: #ccc; } #wrapper{ clear: both; width: 98%; position: relative; left: 1%; top: 90px; } .cleaner{ height: 0px; clear: both; } .fl{ float: left; } .fr{ float: right; } .pic_link{ text-transform: none; cursor: pointer !important; } .pointer{ cursor: pointer !important; } .pic_link:hover{ text-transform: none; } img{ border: 0; } .spacer10{ display: block; height: 10px; clear: both; } .spacer20{ display: block; height: 20px; clear: both; } .spacer30{ display: block; height: 30px; clear: both; } .no_decoration{ text-decoration: none !important; cursor: text !important; } .underline{ text-decoration: underline !important; } .image_link{ cursor: pointer; border: 0; } .user_pic{ border: 1px solid #d9d9d9 !important; } So for some reason browser won't render CSS and JS? Why is this the case? Info is being outputted, is something wrong with my html tags or something?
-
Mysql num_rows shows 3 results, fetch array outputs only 2.
Ivan Ivković replied to Ivan Ivković's topic in PHP Coding Help
All my template class does is recieve the data ( template -> any_attribute ) and loads the template (loadTemplate). It does not change the variable/mysqli result object in any way, why should it? Damn strange. <?php class Template{ public $vars; private $registry; public function __construct($registry){ $this -> registry = $registry; } public function __set($index, $value){ $this -> vars[$index] = $value; } public function loadTemplate($tpl){ $path = $this -> registry -> router -> dir_path . '/' . $tpl . '.php'; if(file_exists($path) == false){ throw new Exception('Template not found in '. $path); return false; } if(!empty($this -> vars)){ foreach($this -> vars as $key => $value){ $$key = $value; } } include($path); } } I do not see the problem here. Do you maybe? About sub-optimal. Yea I know.. :/ Nothing's perfect I guess. -
Mysql num_rows shows 3 results, fetch array outputs only 2.
Ivan Ivković replied to Ivan Ivković's topic in PHP Coding Help
Hey guys I solved the error. However, I still don't understand it. May be a bug in the MySQLi extension itself.. Instead of: $fetch = $pic -> fetchAlbumPics($user_id, $city_id, $cat_id); if($fetch !== false){ $this -> registry -> template -> result = $fetch; } I've put. $fetch = $pic -> fetchAlbumPics($user_id, $city_id, $cat_id); if($fetch !== false){ $this -> registry -> template -> result = $pic -> fetchAlbumPics($user_id, $city_id, $cat_id); } Still, don't know why this was the problem. -
Mysql num_rows shows 3 results, fetch array outputs only 2.
Ivan Ivković replied to Ivan Ivković's topic in PHP Coding Help
I'm from Balkan.. xD Anyways I'll keep you updated on the error if I find the answer. I'll get back to it now. (was doing some other things) -
Mysql num_rows shows 3 results, fetch array outputs only 2.
Ivan Ivković replied to Ivan Ivković's topic in PHP Coding Help
Yea it's just one of those things you don't "see". :/ -
Mysql num_rows shows 3 results, fetch array outputs only 2.
Ivan Ivković replied to Ivan Ivković's topic in PHP Coding Help
The fetch array is always the first row. -
Mysql num_rows shows 3 results, fetch array outputs only 2.
Ivan Ivković replied to Ivan Ivković's topic in PHP Coding Help
Amen. -
Mysql num_rows shows 3 results, fetch array outputs only 2.
Ivan Ivković replied to Ivan Ivković's topic in PHP Coding Help
I have, it displays the result that is not being looped. -
Mysql num_rows shows 3 results, fetch array outputs only 2.
Ivan Ivković replied to Ivan Ivković's topic in PHP Coding Help
Ok I can no longer give you sample outputs, I must continue to work on this. If there's anyone who already guesses what's the problem/solution, thank you. -
Mysql num_rows shows 3 results, fetch array outputs only 2.
Ivan Ivković replied to Ivan Ivković's topic in PHP Coding Help
Thank you! -
Mysql num_rows shows 3 results, fetch array outputs only 2.
Ivan Ivković replied to Ivan Ivković's topic in PHP Coding Help
Please look at the page again. Explains it all. The BOM issue you're seeing is just because I'm outputting sample data from controller/model files. -
Mysql num_rows shows 3 results, fetch array outputs only 2.
Ivan Ivković replied to Ivan Ivković's topic in PHP Coding Help
There. This is the live link btw. http://pixpresso.mycyberlove.com/album/list_/26/0/51295 And the problem is NOT in the query, the query has been tested. -
This is the method from the picture model. public function fetchAlbumPics($user_id, $city_id, $cat_id){ if($cat_id == 0 && $user_id != 0 && $city_id != 0) $query = 'SELECT * FROM sc_pics WHERE user_id="' . $user_id . '" AND city_id="' . $city_id . '"'; if($cat_id != 0 && $city_id != 0 && $user_id != 0) $query = 'SELECT * FROM sc_pics WHERE user_id="' . $user_id . '" AND city_id="' . $city_id . '" AND cat_id="' . $cat_id . '"'; $result = $this -> db -> query($query); $return = $result -> num_rows ? $result : false; return $return; } This is where it's being called. $fetch = $pic -> fetchAlbumPics($user_id, $city_id, $cat_id); if($fetch !== false){ $this -> registry -> template -> pics = $fetch; } This is the view where it's being outputted: <?php if(isset($pics)){ echo $pics -> num_rows; while($fetch = $pics -> fetch_array()){ $description = $fetch['description'] == '' ? 'No Description' : $fetch['description']; ?> <div class="element item"> <a class="item_link" href="/photo/view/<?php echo $fetch['pic_id'] ?>"> <img class="img" src="/thumb.php?pic=content/pics/<?php echo $fetch['user_id'] . $fetch['src'] ?>&h=250&w=250"/> </a> </div> <?php } } ?> Result: mysql_num_rows returns 3 results, the script outputs only 2 results/pictures. SQL query in PHPMYADMIN outputs 3 results... This loops only 2 results, I don't know why. There's no bug inside the loop, since I've tried only echoing number 0 instead of outputting information. Only outputs 2 times. I don't know how to fix this for now. And the problem is NOT in the query, the query has been tested.
-
Should I attach pagename.css for each page or should I include all css rules in one css file? My logic is if you load the huge css file every time, the page will be slower, and if you split them by purpose (for each page or widget), you'll get a faster output. Is that true?