PHP - Ob_start But Css Still Renders Layout Late In Ff
Hi,
this, i think, is a 'php in firefox' issue despite me mentioning css in the title so please read on!.. please have a look, using firefox, at http://www.laureleroch.com/gallery.php... As you can see, when choosing different images via clicking on the thumbnails the page reloads and there's an amount of time where we see the page loaded without css applied..., however doesn't seem to be happening in IE9, opera, chrome, or safari. It IS happening in firefox on W7 and OSX. the file gallery.php has... <?php session_start(); ob_start(); include("scripts/php/gallery_display.php"); include("scripts/php/file_reader.php"); ...as its start...and... </body> </html> <?php ob_flush() ?> ..at its end. I can post all the code from the includes if required. I'd say there's a fair bit of processing done by these includes but really, not THAT much, plus other browsers seem to be doing ok with it. Also, the background images are big. That's a fact. The site will be in this way and I plan to use a preloader once I get the main build sorted...nearly there. One other thing...I really am a coding newbie. I've been toying with it for years, first with actionscript in flash, then html/css and now I'm getting really into php, however I'm sure my coding is pretty inefficient here and there thru nothing other than pure, undiluted ignorance...good, eh?! so, if anyone got some pointers that would be really brilliant... any other info required - please shout. cheers, Scott Similar TutorialsThis topic has been moved to PHP Applications. http://www.phpfreaks.com/forums/index.php?topic=355260.0 Hey guys, this is just a general question. I read about late static binding and started developing with it on my local server but I noticed that hostgator still runs on 5.2.. Should I use late static binding? (im planning to code an open source CMS) I am trying to write a more elegant solution to be able to check an object, find only the properties in an object that have values, and update those values in a database with a matching ID. I am extending a class from a generic user class here is an example of my code Code: [Select] <?php require_once('User.php'); require_once('Database.php'); class Vendor extends User { protected static $vendor_attributes = array('id', 'nothing' , 'tagline' , 'bio'); protected static $table_name = "user_vendors"; public $tagline; }//close class ?> Hi, I have been trying to improve my PHP programming skills by following the Lynda.com Beyond the basics tutorial and they came to a section where they were building common database methods inside a database class. Since they did not have PHP 5.3 (Where late static bindings is introduced) they had to place code referring to self:: inside of each class that needs this functionality. It seems that not having late static binding was binding self to the database class and not to other classes that call it statically. I will insert some code to explain this better. Long story short, I was really interesting in getting an attributes function working and as I do not have late static bindg either, I cannot figure out how to call it from inside a class to make it function correctly. Here is some code. Below is the attribute class they wrote. Each class declared an array of attributes for each of the classes that want to call this method like protected static $db_fields = array('id', 'email', 'password', 'etc'); Code: [Select] protected function attributes() { // return an array of attribute names and their values $attributes = array(); foreach(self::$db_fields as $field) { if(property_exists($this, $field)) { $attributes[$field] = $this->$field; } } return $attributes; } They planned on moving this code to a DatabaseObject class after they get LSB but until then, have to include it in every class that wants use this. Is there any way to write this as a function, include it in a class, and call the method without late static binding.. or even place this inside a database class and call it from another class without LSB? Forgive me if I am not explaining this correctly, again, I am still learning. My version of PHP is 5.2.6. Hey guys, what's the purpose of using ob_start() in the begining of the script? I even saw alot of people turning output buffering by default in their php.ini file ! What's the benefit of this action ? Thanks in advance Hello, I am trying to change the string 'IRM Reporting Portal' to 'BIS Reporting Portal' as illustrated in the attachment 'Requirements.jpg'. On inspecting 'IRM Reporting Portal', I noticed the function DoResizeMS (). I found this function call in only one file across the entire code. That file is 'header.dsp' (attached) This leads me to believe that the string 'IRM Reporting Portal' is being dynamically generated in 'header.dsp' (Between ob_get_contents() and ob_start()) How do I change that string to 'BIS Reporting Portal'? Please help. I am a PHP newbie. Thanks, Trinanjan. i enabled my output_buffering i used ob_start() and ob_end_flush functions i did'nt put any html tag before my php i used rapid php 2010 so dont know it making utf8 or not and i dont know how to check it i read many forums threads but cant find answer please answer but still i'm not redirecting to index.php from login.php here is my login.php <?php require_once("../../includes/database.php"); require_once("../../includes/functions.php"); require_once("../../includes/user.php"); require_once("../../includes/session.php"); if($session->is_logged_in()) { redirect_to(index.php); } //redirect_to("index.php"); if(isset($_POST['submit'])) //... if submit button is clicked { $username = trim($_POST['username']); $password = trim($_POST['password']); // check in database to see if username/password exist $found_user = User::authenticate($username,$password); // if we get some record in var $found_user if($found_user) { $session->login($found_user); // echo $found_user->username; // here is problem not redirecting redirect_to("index.php"); // this method is user define in function.php } else { //where i put header() $message = "Password/Username combination is not correct."; } } else { $username =""; $password =""; } ?> <html> <head>....... here is my function.php <?php function redirect_to( $location = NULL ) { if ($location != NULL) { header("Location: {$location}"); exit; } } function output_message($message="") { if (!empty($message)) { return "<p class=\"message\">{$message}</p>"; } else { return ""; } } ?> i'm attaching files too Which of these is the "best coding practice" for the proper order of "ob_start," "sessions," and "require?" (my "require" files are usually just mySQL login stuff):
a.)
b.) And also, instead of just plain "session_start()" isn't it more proper to ALWAYS use if(!isset($_SESSION)) { session_start(); } Thank you in advance.
I have just uploaded my 1st website project in my online server and the 1st error that I got is something like "Header ouput buffer" error. I have research on how to solve it and and I read that ob_start() will solve it. I have use it on the file that I'm having problem with and it instantly solve the problem. My question is... Is it always always ok to use it? I mean will it cause a slow page load or any conflicting errors that I might encounter in the future? another thing is... do I always need to end it? like put this end code "ob_end_flush(); " at the end of the line or it isn't necessary anymore? Hello, I am an absolute PHP newbie, and I have something which is probably a very stupid question. Nevertheless, I am stuck, despite Google and reading the docs. Here a very cut down example code: Code: [Select] <?php ob_start(); echo "123\n"; $body = ob_get_flush(); echo "body = ".$body; ?> I would have expected the output to be body = 123 It actually is 123 body=123 ie ob_start does indeed buffer the output, but it does not prevent if from getting through. This happens both on my Mac with 5.3.10, and on my server where I dont know the PHP version (...newbie...) Any help would be appreciated! Hi there, I am trying to create a file using fwrite function, but for something reason all I get is a blank file with no content inside. Here is the code, go to the bottom where the fwrite function is called: <?php //Get Nohay Albums function function GetAlbums($cattype){ if ((isset($_GET['year']))||(isset($_GET['reciter']))){ //nothing displayed } else{ $query = "SELECT COUNT(Topic), SUM(Hits) AS totalhits, FileFormat, Speaker, Language, Year, FileType, Cat FROM nauhey WHERE Cat='".addslashes($cattype)."' AND Year='".date('Y')."' GROUP By Speaker, Year"; $result = mysql_query($query) or die (mysql_error()); //<!------------ Create Cache -------------!> //folder where cache is saved $path = "cache/"; //Page name format: FunctionName_Category_Year.html $pagename = $path."getalbums_".$cattype.".html"; $cacheFile = fopen($pagename, "w"); if ($cacheFile == FALSE){ die ("Unable to create cache file"); } //Get HTML in a variable $obstart = ob_start(); if ($obstart == FALSE){ die ("Unable to buffer cache content!"); } //<!------------ Cache closed -------------!> if ($cattype = strtolower('nauhey')){ while ($row = mysql_fetch_array($result)){ echo ("<div class='container'>"); echo ("<img src=\"http://localhost/HAQMOLAAALI/backed up/haqmolaali/images/".$row['FileFormat'].".gif\">"); echo ("<b style=\"font-size:10px; color:#000066; position:absolute; margin-left: 500px;\">DOWNLOADS: ".$row['totalhits']."</b>"); echo (" <a href=\"nohay.php?reciter=".urlencode($row['Speaker'])."&year=".urlencode($row['Year'])."\">".$row['Speaker']." Vol ".$row['Year']."</a> <b style=\"font-size:10px; color:#000000;\">(".strtoupper($row['Language']).")</b>"."\n"); echo ("<div class='small'><b>Year: ".$row['Year']." | Language: ".ucfirst($row['Language'])." | Tracks: ".$row['COUNT(Topic)']."</b></div>"); echo ("</div>"); }//while loop closed } else { while ($row = mysql_fetch_array($result)){ echo ("<div class='container'>"); echo ("<img src=\"http://localhost/HAQMOLAAALI/backed up/haqmolaali/images/".$row['FileFormat'].".gif\">"); echo ("<b style=\"font-size:10px; color:#000066; position:absolute; margin-left: 500px;\">DOWNLOADS: ".$row['totalhits']."</b>"); echo (" <a href=\"majlis.php?reciter=".urlencode($row['Speaker'])."&year=".urlencode($row['Year'])."\">".$row['Speaker']." Vol ".$row['Year']."</a> <b style=\"font-size:10px; color:#000000;\">(".strtoupper($row['Language']).")</b>"); echo ("<div class='small'><b>Year: ".$row['Year']." | Language: ".ucfirst($row['Language'])." | Lectures in series: ".$row['COUNT(Topic)']."</b></div>"); echo ("</div>"); } } //<!------------ Cache Code -------------!> $cacheContent = ob_get_contents(); //Write to cache file fwrite ($cacheFile, $cacheContent) or die ("Cannot write cache content to file!"); fclose ($cacheFile); ob_flush(); ob_end_clean(); //<!------------ Cache Closed-------------!> } } GetAlbums("nauhey"); ?> When I execute the function, I get my self-made error "Cannot write cache content to file!". Help would be much appreciated. Thank you. I am trying to use output buffering in the following manner: Code: [Select] ob_start("OB_BUFFER"); echo 'Start'; do_stuff_function(); ob_end_clean(); echo 'End'; The problem is that when the output of "do_stuff_function" exceeds 4k the output is automatically flushed and I don't know why (exceeding some limit I suppose). So when the output of "do_stuff_function" is less than 4k, I get this: Code: [Select] Start My <4k output here... End When "do_stuff_function" exceeds 4k, I end up with this: Code: [Select] My > 4k output here... Start End I don't understand why this is. The docs seem to indicate that the way I am starting the ob_start() function there should be no buffer limit. Is that not true? This is really strange and throwing me for a loop. I suspect there's a config setting somewhere in my PHP setup on my server which I am missing... I have a PHP script that renders a vector drawing (as a series of lines/points) into a png image. When I'm testing the script on my local machine (XAMPP + OSX) everything works great. When the script runs on my host (hostgator) the imagefilledellipse() function renders as a square instead of a circle. Screenshots below. Try the server version for yourself at http://sundrynotes.com/alpha/ (press "create new note" in the lower right then long-press on the note and select the "whiteboard" option, draw, then press "accept"). Hi I don't know if this is the right section but I would like to have my gallery open up in the content section. For example I have a page which has the gallery links on the navigation side and I want it to open in the content side. I have only been able to open it up in a new page. I'm using php to get the images. Here is my default.php code: Code: [Select] <head> <title><?php echo $this->get_title(); ?></title> <meta name="Description" content="<?php echo $this->get_description(); ?>" /> <meta name="Keywords" content="<?php echo $this->get_keywords(); ?>" /> <title>Welcome to the Framework</title> <?php $this->_page->add_javascript('/vendor/lightbox/js/jquery.lightbox-0.5.min.js'); $this->_page->add_stylesheet('/vendor/lightbox/css/jquery.lightbox-0.5.css'); $this->_page->add_stylesheet('/css/default.css'); echo $this->page('stylesheets'); echo $this->page('javascripts'); ?> </head> <body> <div id="container"> <div id="banner"> <h1> Welcome to the Grada djeri </h1> </div> <div id="nav"> <?php echo $this->page('view'); ?> </div> <div id="content"> <?php ?> </div> <div id="footer"> <a href="/pages/about_me">About Me</a> <a href="/pages/contacts">Contacts</a> <a href="/pages/home">Home</a> </div> </div> </body> </html> and here is my home.php Code: [Select] <!-- <h2>This is the homepage</h2>--> <?php //echo $this->_params['item']['content']; // how to loop through an images and gallery name and put it into a list foreach ($this->_params['list'] as $gallery ){ $gallery_name = $gallery['name']; $image = $gallery['image']; echo "<table>"; echo "<tr>"; echo "<td>"; echo "<a href=/galleries/view/".$gallery['id']."><img src='/image.php?path=$image&h=50&w=50'></a>"; echo "</td>"; echo "</tr>"; echo "</table>"; } ?> Hi, Please can someone tell me what I need to change in this code to correct the layout of the attached page. Many thanks, Mark.
<?php /** * Edit account form * * @author WooThemes * @package WooCommerce/Templates * @version 2.2.0 */ if ( ! defined( 'ABSPATH' ) ) { exit; } ?> <?php wc_print_notices(); ?> <?php do_action( 'woocommerce_edit_account_form_start' ); ?> <?php _e( 'First name', 'woocommerce' ); ?> * <?php _e( 'Last name', 'woocommerce' ); ?> * <?php _e( 'Email address', 'woocommerce' ); ?> * <?php _e( 'Password Change', 'woocommerce' ); ?> <?php _e( 'Current Password (leave blank to leave unchanged)', 'woocommerce' ); ?> <?php _e( 'New Password (leave blank to leave unchanged)', 'woocommerce' ); ?> <?php _e( 'Confirm New Password', 'woocommerce' ); ?> <?php do_action( 'woocommerce_edit_account_form' ); ?> <?php wp_nonce_field( 'save_account_details' ); ?> <?php do_action( 'woocommerce_edit_account_form_end' ); ?> <?php /** * Edit account form * * @author WooThemes * @package WooCommerce/Templates * @version 2.2.0 */ if ( ! defined( 'ABSPATH' ) ) { exit; } ?> <?php wc_print_notices(); ?> <form action="" method="post"> <?php do_action( 'woocommerce_edit_account_form_start' ); ?> <p class="form-row form-row-first"> <label for="account_first_name"><?php _e( 'First name', 'woocommerce' ); ?> <span class="required">*</span></label> <input type="text" class="input-text" name="account_first_name" id="account_first_name" value="<?php echo esc_attr( $user->first_name ); ?>" /> </p> <p class="form-row form-row-last"> <label for="account_last_name"><?php _e( 'Last name', 'woocommerce' ); ?> <span class="required">*</span></label> <input type="text" class="input-text" name="account_last_name" id="account_last_name" value="<?php echo esc_attr( $user->last_name ); ?>" /> </p> <p class="form-row form-row-wide"> <label for="account_email"><?php _e( 'Email address', 'woocommerce' ); ?> <span class="required">*</span></label> <input type="email" class="input-text" name="account_email" id="account_email" value="<?php echo esc_attr( $user->user_email ); ?>" /> </p> <fieldset> <legend><?php _e( 'Password Change', 'woocommerce' ); ?></legend> <p class="form-row form-row-thirds"> <label for="password_current"><?php _e( 'Current Password (leave blank to leave unchanged)', 'woocommerce' ); ?></label> <input type="password" class="input-text" name="password_current" id="password_current" /> </p> <p class="form-row form-row-thirds"> <label for="password_1"><?php _e( 'New Password (leave blank to leave unchanged)', 'woocommerce' ); ?></label> <input type="password" class="input-text" name="password_1" id="password_1" /> </p> <p class="form-row form-row-thirds"> <label for="password_2"><?php _e( 'Confirm New Password', 'woocommerce' ); ?></label> <input type="password" class="input-text" name="password_2" id="password_2" /> </p> </fieldset> <div class="clear"></div> <?php do_action( 'woocommerce_edit_account_form' ); ?> <p> <?php wp_nonce_field( 'save_account_details' ); ?> <input type="submit" class="button" name="save_account_details" value="<?php _e( 'Save changes', 'woocommerce' ); ?>" /> <input type="hidden" name="action" value="save_account_details" /> </p> <?php do_action( 'woocommerce_edit_account_form_end' ); ?> </form> Spoiler Hi,
I am trying to align sections of my CSS layout side-by-side, but I am having problems with it.
I expect the left sidebar (#aside) with a 30% width to meet with the content section (#content) of the width of 70%. But, the changes I make are not translating as expected.
See attached screenshort of what is happening and the CSS code bellow:
#container { margin: 0 auto; width: 800px; background: #fff; } #header { background: #5a83c3; padding: 20px; } #header h1 { margin: 0; } #navigation { float: left; width: 100%; background: #d1dceb; border-top: 1px solid #fff; } #navigation ul { margin: 0; padding: 0; } #navigation ul li { list-style-type: none; display: inline; } #navigation li a { display: block; float: left; padding: 5px 10px; color: #fff; text-decoration: none; border-right: 1px solid #fff; } #navigation li a:hover { background: #383; } #content-container { float: right; width: 100%; background: #FFF url(layout-two-liquid-background.gif) repeat-y 68% 0; } #content { clear: right; float: right; width: 70%; padding: 10px 0; margin: 0 0 0 4%; display: inline; background: #dfe6ef; border-top: 1px solid #fff; border-left: 1px solid #fff; border-bottom: 1px solid #fff; } #content h2 { margin: 0; } #aside { float: left; width: 20%; padding: 10px 0; margin: 0 3% 0 0; display: inline; background: #d1dceb; border-top: 1px solid #fff; } #aside h3 { margin: 0; } #footer { clear: right; background: #d1dceb; text-align: right; padding: 20px; width: 68%; float: right; overflow: hidden; } #footer p.left { float: left; text-align: left; margin-left: 5px; } #footer p.right { float: right; text-align: right; margin-right: 5px; }Attached Files screenshort.png 90.3KB 0 downloads Hello, I need some help modifying some code. I would like to change the layout to show more then currently offered. As of now I have a layout that shows either 3 or 10 images. I tried to change the numbers, but no luck and I can not seem to be able to change to view more. Any help would be great! Code: [Select] // image list $mysqlDataImage = mysql_query( "SELECT * FROM $DB_IMAGE where collectionID=$cat $where ORDER BY $order_by" ); $dataLength = mysql_num_rows( $mysqlDataImage ); $totalImages = $dataLength; //$cat_scrollview = 3; //FORCE SCROLLER if($scrollview == "smaller"){ $cat_scrollview = 0; } //User Override //SWITCH SCROLL LAYOUT BASED ON VIEW : HANDLES COLUMNS, ROWS, PAGES AND SHOW ALL if (($cat_scrollview == 3)||($scrollview == "bigger")){ $PAGE_SIZE = 3; //how many pics per page, all set in html $rowDefault = 1; //row default-changes the most $colDefault = $totalImages/ 1; //columns default use to breakup columns //echo "cols=".$colDefault; //echo "totalimage=".$totalImages; //See getNumberOfRows() $totalPages = $totalImages/$PAGE_SIZE; $cat_scrollview = 3; $scrollview = "bigger"; }else{ $PAGE_SIZE = 10; //how many pics per page, all set in html $rowDefault = 2; //row default-changes the most $colDefault = $totalImages/ 2; //columns default use to breakup columns //echo "cols=".$colDefault; //echo "totalimage=".$totalImages; //See getNumberOfRows() $totalPages = $totalImages/$PAGE_SIZE; $cat_scrollview = 0; $scrollview = "smaller"; } I am new to PHP so please be kind (and explain slowly) Thank you! What is the correct order for HTML? <html> <head> <title> </title> </head> <body </body> </html> Hi
I've inherited a form that sends the basic text email for output. I want to style this with html so the output forms into two columns in a table. I can see how others have incorporated html into their php script, but can't work out how to do it for the coded forms I have. See code below.
$diyf_today = date("jS F Y"); $diyf_subject = "Staff and Student Room Booking Request"; $diyf_feedback = " Student Number: $studentno \r\n School, College or Unit: $unit \r\n Name: $name \r\n Email: $email \r\n Phone: $phone \r\n Event: $event \r\n Event Description: $eventdesc \r\n Event Date: $eventdate \r\n Event Time: $eventtime \r\n Location: ".implode(', ', ${'location[]'})." \r\n If external location: \r\n - External Name of location: $extname \r\n - External Contact Person: $extperson \r\n - External Contact Email: $extemail \r\n - External IP Address: $extIP \r\n \r\n Number Attending: Coffs $coffs; GC $gc; Lismore $lismore; NMSC $nmsc; THSS $thss; External $ext \r\n Do you require videolink: $videolink \r\n Location of videolink: $videolocation \r\n Do you require recording: $recorded \r\n Do you require additional AV equipment and support: $av \r\n - Type of equipment and support: $equip \r\n Do you require additional support: $support \r\n - Type of additional support: $support1 \r\n Additional Comments: $comment "; $diyf_mailTo = "luke.davis@scu.edu.au"; $diyf_mailSubject = stripslashes($diyf_subject); $diyf_mailBody = stripslashes($diyf_feedback); $diyf_mailBody .= "\r\n\r\nThis Room Booking Request form was sent from the Student website on the $diyf_today \r\nReturn Email: $email"; // Do not allow anything in here but valid emails, MUST pass through email validation, DO NOT put anything else in here!!! $diyf_mailHeader= "From: $email\r\n" . "Reply-To: $email\r\n" . "X-Mailer: PHP/" . phpversion(); $diyf_mailHeaderToUser= "From: $diyf_mailTo\r\n" . "Reply-To: $diyf_mailTo\r\n" . "X-Mailer: PHP/" . phpversion(); $sent = mail($diyf_mailTo,$diyf_mailSubject,$diyf_mailBody,$diyf_mailHeader); $returned = mail($email,$diyf_mailSubject,$diyf_mailBody,$diyf_mailHeaderToUser); if (!$sent || !$returned) { echo '<body><center><br><br><font face=verdana color="Gray"> Sorry, There was a problem submiting your form.<br> Please use your browser\'s back button and re-submit the form.</font></center></body>'; } else { echo ' ';// This gets around the PHP bug for self submitting forms submitting twice on redirect. stupid bugs header("Location: $diyf_success_page"); } Edited by Ch0cu3r, 14 August 2014 - 11:24 AM. This topic has been moved to HTML Help. http://www.phpfreaks.com/forums/index.php?topic=348773.0 |