ignace
Moderators-
Posts
6,457 -
Joined
-
Last visited
-
Days Won
26
Everything posted by ignace
-
Hello i am experimenting with the content first thingy so first comes my title then the main content, then the navigation, etc... Then using absolute positioning i place it where it should go. However the problem with this is that when i have to much content it runs through my footer, and when i scroll down the footer remains at what used to be my screen bottom. What i want to do is that my wrapper automatically stretches so that my content is always within a container. Thanks in advance, Ignace Knops index.html <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="nl" xml:lang="nl" dir="ltr"> <head> <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" /> <title>Historie :: Monoposto Racing Series</title> <link rel="stylesheet" media="screen, projection" type="text/css" href="../styles/screen.css" /> </head> <body> <div id="wrapper"> <a name="top"></a> <div id="branding"><h1>Monoposto Racing Series</h1></div> <div id="content"> <h2>A story re-told</h2> <p>Lorem ipsum dolor sit amet</p> </div> <div id="sidebar"> <ul class="list"> <li class="item"><a class="link current" href="index.html">Hoofdpagina</a></li> <li class="item branch"><a class="link" href="info.html">Info</a></li> <li class="item"><a class="link" href="calendar.html">Kalender</a></li> <li class="item"><a class="link" href="pictures.html">Afbeeldingen</a></li> <li class="item"><a class="link" href="results.html">Resultaten</a></li> <li class="item"><a class="link" href="contact.html">Contact</a></li> </ul> </div> <ul id="copyright"> <li class="item"><a class="link" href="copyright.html">© 2009 Monoposto Racing Series. All Rights Reserved.</a></li> </ul> </div> </body> </html> screen.css @import url(reset.css); html, body { height: 100% } body { font-family: Arial, Verdana, Helvetica, sans-serif; font-size: 100%; text-align: center; color: #444; background: #BDBDBD url(../images/assets/bg.jpg) repeat-x fixed } .hidden { display: none } .back-to-top { font-size: .8em; text-align: right } #wrapper { width: 48.75em; /* 780px / 16px = 48.75em */ margin: 0 auto; text-align: left; position: relative; height: 100%; background: #FFF; border-left: 0.3125em solid #222; border-right: 0.3125em solid #222 /* 5px / 16px = 0.3125em */ } #branding { position: absolute; width: 48.75em; /* 780px / 16px = 48.75em */ height: 7.3125em; /* 117px / 16px = 7.3125em */ background: url(../images/assets/banner.jpg) no-repeat; border-bottom: 0.3125em solid #222 } #branding h1 { display: none; font-size: 1.5em; /* 24px / 16px = 1.5em */ } #content { position: absolute; top: 9.375em; /* 150px / 16px = 9.375em */ left: 18.28125em; /* (780px - (780px / 1.6)) / 16px = 18.28125em */ text-align: justify; width: 30.46875em /* ((780px / 1.6) / 16px) - 20px = 29.em */ } #content #gallery { } #content #gallery .title { font-weight: bold } #content #gallery .item { display: inline } #content #gallery .item .image { } #content #gallery .item .caption { } #content h2 { font-size: 1.125em; margin-bottom: 20px } /* 18px / 16px = 1.125em */ #content h3 { font-size: 1.6em; margin-bottom: 20px } /* */ #content h4 { font-weight: bold; margin-bottom: 20px } #content ul { margin: 20px 0 20px 40px; display: list-item; list-style-type: square; font-size: 0.875em /* 14px / 16px = 0.875em */ } #content ul li { } #content p { margin-bottom: 1.25em } #content table { width: 100% } #content table tr { } #content table tr th { font-weight: bold; text-align: center; border-bottom: 1px solid #222 } #content table tr td { } #sidebar { position: absolute; top: 140px; left: 0px; width: 18.28125em; /* (780px - (780px / 1.6)) / 16px = 18.28125em */ } #sidebar .list { background: #E8E8E8; padding: 1.25em; margin: 1.25em /* 20px / 16px = 1.25em */ } #sidebar .list .item { background: url(../images/famfamfam/bullet_black.png) no-repeat; padding-bottom: .5em; /* 8px / 16px = 0.5em */ padding-left: 1.25em } #sidebar .list .branch { background-image: url(../images/famfamfam/bullet_toggle_plus.png) } #sidebar .list .item .current { font-weight: bold; text-decoration: none } #sidebar .list .item .link { color: #222568; text-decoration: underline } #sidebar .list .item .link:hover { text-decoration: none } #sidebar .list .item .sublist { padding-top: 10px } #sidebar .list .item .sublist .subitem { font-size: .8em; padding-bottom: 8px } #sidebar .list .item .sublist .subitem .link { color: #696cad; text-decoration: none } #sidebar .list .item .sublist .subitem .link:hover { text-decoration: underline } #sidebar .list .item:hover .sublist { } #sidebar .list .item:hover .sublist .subitem { } #sidebar .list .item:hover .sublist .subitem .link { } #copyright { position: absolute; bottom: 0px; height: 30px; text-align: center; width: 100%; font-size: .7em; background: #222; padding-top: 5px } #copyright .item { display: inline; padding-right: 10px } #copyright .item .link { color: #888; text-decoration: none } #copyright .item .link:hover { text-decoration: underline }
-
Zend_Auth && Zend_Session && Zend_Session_SaveHandler_DbTable
ignace replied to ignace's topic in PHP Coding Help
bump -
I am using the Zend_Session_SaveHandler_DbTable to store my sessions in the database, session data is stored like: Zend_Auth|a:1:{s:7:"storage";O:8:"stdClass":1:{s:4:"role";s:14:"Anonymous user";}} Zend_Auth does not contain __sleep() nor __wakeup() that is the reason why unserialize() doesn't work when i try to unserialize it, so my question now is: how can i "unserialize" this data to be able to work with it? and optional: how is the system actually able to unserialize() this data?
-
otherwise take a look at PEAR.php which "emulates" static properties, their solution to cover the php4 disability on static properties, don't know if this is what you were looking for
-
Can someone tell me how the following works and how it is called (i can't find anything on the internet, and keywords like and and or display to many results logically): mysql_query("..") or exit(".."); is this also possible using ||? and how does this differ from: someFunction() and someFunction2(); again is this also possible using &&? Do just standard boolean rules apply here, like when used in an if-statement? second question how does set_include_path() work if i output the include_path before setting it it is preceded with a . (dot) which refers to the current working directory (cwd), but when i do: set_include_path("my/common/directory"); require_once "cwdfile.php"; and the file cwdfile is included because it makes sense, it first checks if the file is available in the cwd and includes it, if its not then it utilizes the include_path so why is by default the include_path preceded with a . (dot) it doesn't make sense to check if a file is in the cwd twice, does it? best regards, ignace
-
set_magic_quotes_runtime(0); this turns off the auto slashes, however you will now have to manually add slashes using addslashes()
-
$pw1 >= 6 should strlen($pw1) >= 6 MsgBox()? visual basic developer?
-
true, but maybe john really wanna put in all effort to not use include (or atleast only once and out of sight) i even believe that is what he is referring to in that case: // assuming set_include_path() has already been set function __autoload($className) { require_once($className . ".php"); } // no include or require required, just use: $class = new MyClass();
-
@wildteen wouldn't it be possible using spl_autoload()?
-
@sKunKbad if you use the progressive enhancement (http://en.wikipedia.org/wiki/Progressive_Enhancement) strategy when building websites your website will not only rank better (because of the content first) the website is also much more accessible i think that was what you were referring to
-
remove the zero before the numbers $options = array ( 1 => 'adam', 2 => 'betty', 3 => 'charles', 4 => 'denise', 5 => 'eric', 6 => 'adam', 7 => 'betty', 8 => 'charles', 9 => 'denise', 10 => 'eric' );
-
if you don't have access to the memory_limit directive then there is no way for you to upload big images and you shall have to tell your users to upload images under a certain filesize and deny all images that are to big
-
here hope this helps <?php $dh =@ opendir($directory); if ($dh) { while ($file = readdir($dh)) { if ($file != "." && $file != "..") { $fileInfo = pathinfo($directory . DIRECTORY_SEPARATOR . $file); if ($fileInfo["extension"] === "swf") { echo "<a href='" . $httpPathToDirectory . "/" . $file . "'>" . $file . "</a><br />\n"; } } } }
-
need help with form logic and dynamically generated content
ignace replied to digitalgod's topic in PHP Coding Help
question, answer (textfield) question, answer1, answer2, answer3 (radio) question, answer1, answer2, answer3 (select) question, answer1, answer2, answer3 (select, multiple) question, answer1, answer2, answer3 (checkbox) types (id, type) // values (1, 'text'), (2, 'radio'), (3, 'select'), (4, 'checkbox'), (5, 'select multiple') questions (id, question) answers (id, question_id, answer) question_to_answer (question_id, answer_id, type_id) don't know for certain but an abstract factory would do nice things here -
function map_clicks_to_row($row_id) { global $dbConnection; $query = "SELECT * FROM clickable_rows_table WHERE id = %s"; $result = mysql_query(sprintf($query, $row_id), $dbConnection); if (0 !== mysql_num_rows($result)) { // row exist, make it extra clickable.. } } @dannyb785 and all other phpfreaks forum regulars mysql_query() has a second optional parameter called $link_identifier, leaving this parameter empty will use the latest used open connection to the database, if you like me, use more then one database will this result in a serious rewrite of your code, in my opinion the second parameter shouldn't even be optional
-
Using PHP to process submitted PDF Form and Upload FDF to Server
ignace replied to badaboom55's topic in PHP Coding Help
i think that when you click on a submit button in a pdf form the request is made within the client's browser and nothing is submitted to the server (where php would/could handle it), so you will need to create the logic inside your pdf form is using a normal html form possible? -
if (!isset($_REQUEST['my-cookie']) && isset($_REQUEST['specific-button-click'])) { setcookie('my-cookie', $data, ..); }
-
hope this helps as long you keep your view solely for rendering, your model solely for fetching and manipulating data and your controller only has possible user actions defined you should be ok! class View { function __set($key, $value) {} function __get($key) {} function __isset($key) {} function __call($helper, $args) {} } abstract class ActionController { var $view; function init() { $this->view = new View(); } } // assume ?model=foo&controller=bar&action=view&id=1 // or with mod_rewrite /foo/bar/view/id/1 class FrontController extends ActionController { function dispatch($action, $controller, $module = null, array $params = array()) { if (!$module) { $module = '<default-module-maybe-specified-in-your-config-file-fetch-using-the-registry>'; // or just: $module = 'default'; } // open modules directory, open module $module directory, search for class $controllerController.php and create an instance of it // if module is specified, then prefix controller using the module name $controllerName = ucfirst($controller) . "Controller"; require_once $modulePath . DIRECTORY_SEPARATOR . $controllerName . ".php"; if ($module) $controllerName = ucfirst($module) . "_" . $controllerName; if (!class_exists($controllerName)) { // file loaded but Module_ControllerController() was not declared inside the file } $controller = new $controllerName(); $actionName = $action . "Action"; if (method_exists($actionName, $controller)) { $controller->$actionName($params); } } } // example controller class BlogController extends ActionController { var $model; function init() { $this->model = new BlogsModel(); // BlogsModel is a table data gateway pattern parent::init(); } function editAction(array $requestParams = array()) { $id = (int) $requestParams['id']; $row = $this->model->findRow($id); if (0 !== sizeof($row)) { // provide data for rendering in /blog/edit.html $this->view->rowData = $row; } } } // /blog/edit.html <!-- file is included within the view object use it's functionality --> <?php echo $this->render('head.html'); ?> <h1>Editing: "<?php echo $this->rowData['title']; ?>"</h1> .. form with populated input fields .. <?php echo $this->render('foot.html'); ?>
-
try file_get_contents("http://mama-mia.com/index.php"); make sure your the allow_url_fopen directive is correctly set
-
quite impressive you nicely took my advice except for separating the model from the controller. The view actually is some sort of template engine, where it includes an html page and replaces values within the html with internal values usually coming from models. I also see you have done a read up on patterns (Registry pattern in particular) nice job!
-
number_format() you can find the correct syntax in the manual
-
well i am not trying to be rude, but that script is everything but safe, you are vulnerable to sql injection and php injection (if register_globals = on) advices: - encapsulate your db connection and its configuration variables - use prepared queries - do not only use stripslashes() but also validate it using ctype (http://be.php.net/manual/en/book.ctype.php) - do not store to much information in your session, storing a user id is more than sufficient (certainly do not store passwords in sessions) - enable full error reporting when in your development environment, disable all error reporting on production (for example create a function that when called on your development server it echo's the message and on your production server it stores it to a password protected directory on your server or under your server root
-
php is not enabled on your apache server, if you don't have an idea how to configure php, mysql and apache together then consider using xampp http://www.apachefriends.org/en/xampp.html
-
you can find that in the manual search for setlocale() set your countries locale and the time should automatically adjust
-
anyone can figure out what is wrong with this? when i try to multiply the result i get is wrong, i checked the documentation and my implementation is correct but php thinks otherwise <?php /** * Class for calculating complex numbers * * @author Ignace Knops <developer.ignace@gmail.com> * @version 1.0 */ class Complex { /** * Real number * * @var integer */ var $a; /** * Imaginary unit * * @var integer */ var $b; /** * Class constructor * * @param integer * @param integer */ function Complex($a = 1, $b = 1) { $this->a = (int) $a; $this->b = (int) $b; } /** * * * @param integer|Complex * @param integer * @return Complex */ function add($a, $b = null) { $a = (int) $a; $b = (int) $b; if (!is_a($a, 'Complex')) { $a = $this->a + $a; $b = $this->b + $b; } else { $c = $this->a + $a->a; $b = $this->b + $a->b; $a = $c; } return new Complex($a, $b); } /** * * * @param integer|Complex * @param integer * @return Complex */ function subtract($a, $b = null) { $a = (int) $a; $b = (int) $b; if (!is_a($a, 'Complex')) { $a = $this->a - $a; $b = $this->b - $b; } else { $c = $this->a - $a->a; $b = $this->b - $a->b; $a = $c; } return new Complex($a, $b); } /** * * * @param integer|Complex * @param integer * @return Complex */ function multiply($a, $b = null) { $a = (int) $a; $b = (int) $b; if (!is_a($a, 'Complex')) { $a = (($this->a * $a) - ($this->b * $b)); $b = (($this->a * $b) + ($this->b * $a)); } else { $c = (($this->a * $a->a) - ($this->b * $a->b)); $b = (($this->a * $a->b) + ($this->b * $a->a)); $a = $c; } return new Complex($a, $b); } /** * Alias for __toString() * * @return string */ function toString() { return $this->__toString(); } /** * Returns a string version of the complex number * * @return string */ function __toString() { return sprintf("%s + %si", $this->a, $this->b); } } for example require_once 'Complex.php'; $c = new Complex(4, 7); echo $c->multiply(5, -3)->toString(); // returns 41 + 275i while it should be: 41 + 23i the formula: (a + bi) * (c + di) = (ac - bd) + (ad + bc)i. my multiply() method with adjusted params: /** * * * @param integer|Complex * @param integer * @return Complex */ function multiply($c, $d = null) { $a = (int) $a; $b = (int) $b; if (!is_a($a, 'Complex')) { $a = (($this->a * $c) - ($this->b * $d)); $b = (($this->a * $d) + ($this->b * $c)); } else { $e = (($this->a * $c->a) - ($this->b * $c->b)); $b = (($this->a * $c->b) + ($this->b * $c->a)); $a = $e; } return new Complex($a, $b); }