PHP - Layout Issue
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 Similar TutorialsFolks, I remember once having a php or html5 issue where the first option had to be blank in the drop down. Otherwise, it wasn't working. What wasn't working ? How wasn't working ? I can't remember. either php had difficulty reading user input or the drop down was not showing any options. And so, I had to add a blank value. So, something like this wasn't working ...
<label for="tos_agreement">Agree to TOS or not ?</label> <select name="tos_agreement" id="tos_agreement"> <option value="yes">Yes</option> <option value="no">No</option> </select>
And, I think I added a blank value, at somebody's advice, to get it to work. I think it was something like this, if I remember correctly:
<label for="tos_agreement">Agree to TOS or not ?</label> <select name="tos_agreement" id="tos_agreement"> <option value=" ">Select here</option> <option value="yes">Yes</option> <option value="no">No</option> </select>
Or, maybe it was something like this:
<label for="tos_agreement">Agree to TOS or not ?</label> <select name="tos_agreement" id="tos_agreement"> <option value=" "></option> <option value="yes">Yes</option> <option value="no">No</option> </select>
I can't remember. All I remember slightly that there was a blank value. I been going through my php files to find that particular file to jog my memory but I failed to find it. Can you folks explain to me if a blank value is required or not ? What is the benefit/disaster of adding it and how should the blank value be added ? Show me an example.
Was this a php or html 5 issue ? Can anybody fugure ?
Thank You Hi, I have this code below which groups all the SubHeading together and then queries the same table to find RiskConsequence which are grouped that match SubHeading then to query this table one more last time with all the Risk Mitigation that matches the grouped RiskConsequence. Problem I get is it does the SubHeading, the RiskConsequences it only does one of them not all of them before it moves onto the RiskMitigation. I know I have a php coding issue just cant see the wood from the tree's as the queries work. Code: [Select] <?php include ("include.php"); $query = "SELECT * FROM tblriskassessmentdatabank GROUP BY SubHeading"; $results = mysql_query($query) or die("Error: " . mysql_error()); while($row1 = mysql_fetch_array($results)){ echo'<a href="#" onClick="return(changeDisplay(';echo"'";echo($row1[SubHeading]);echo"'))";echo'">';echo($row1[SubHeading]);echo'</a><br /><br />'; echo'<div id="';echo($row1[SubHeading]); echo'" class="HideText">'; $risksub = $row1[SubHeading]; $query1 = "SELECT * FROM tblriskassessmentdatabank GROUP By RiskConsequence"; $results1 = mysql_query($query1) or die("Error: " . mysql_error()); while($row2 = mysql_fetch_array($results1)){ echo'<a href="#" onClick="return(changeDisplay(';echo"'";echo($row2[RiskConsequence]);echo"'))";echo'">';echo($row2[RiskConsequence]);echo'</a><br />'; echo'<div id="';echo($row2[RiskConsequence]); echo'" class="HideText">'; $risksub1 = $row2[RiskConsequence]; $query1 = "SELECT * FROM tblriskassessmentdatabank WHERE RiskConsequence = '$risksub1'"; $results1 = mysql_query($query1) or die("Error: " . mysql_error()); while($row3 = mysql_fetch_array($results1)){ echo'<input name="checkbox[]" type="checkbox" id="checkbox[]" value="';echo($row3[IssueNumber]);echo'" /> <label for="checkbox[]"></label>';echo($row3[RiskMitigation]);echo'<br /><br />'; } echo'</div>'; } echo'</div>'; } ?> 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! 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,
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 This topic has been moved to Application Design. http://www.phpfreaks.com/forums/index.php?topic=347419.0 This topic has been moved to HTML Help. http://www.phpfreaks.com/forums/index.php?topic=348773.0 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. What is the correct order for HTML? <html> <head> <title> </title> </head> <body </body> </html> first person to solve this gets an automatic, irrevocable entry into my VIP Holiday Card Master List. ive been tussling with it for hours over two days and cannot figure out what the problem is.
site: http://104.152.168.18/~redtagsp/
you'll see five image buttons in the center of the homepage. red bg is for diagnostic only. the third of the smaller images in the top row is sitting slightly lower than the others. the containing element (transparent black) is floated as are all 5 images within it. and the text-div above the images. seems really simple but ive had these frigging elements bobbing all around and this is the best i can get them. my guess is there is some CSS outside of my own (this is a Wordpress site) that is screwing things up for me but i cant find it.
here is the HTML for the containing element:
<div id='home_buttons'> <div id='free_shipping'><strong>FREE</strong> Shipping on all orders over $40</div> <a href=''><img src='/~redtagsp/wp-content/themes/bmw_storefront_child/pics/buttons/button_blank_pucks.png' class='home_button_small'></a> <a href=''><img src='/~redtagsp/wp-content/themes/bmw_storefront_child/pics/buttons/button_custom_pucks.png' class='home_button_small'></a> <a href=''><img src='/~redtagsp/wp-content/themes/bmw_storefront_child/pics/buttons/button_custom_pucks.png' class='home_button_small'></a> <div style='float:left; clear:both; width:100%; height:5px;'></div> <a href='' class='link_button_large'><img src='/~redtagsp/wp-content/themes/bmw_storefront_child/pics/buttons/tape.png' class='home_button_large'></a> <a href='' class='link_button_large'><img src='/~redtagsp/wp-content/themes/bmw_storefront_child/pics/buttons/balls.png' class='home_button_large'></a> </div>here is the CSS directly associated with the above: #home_buttons { float:left; width:95.4%; padding:1%; margin:100px 1% 20px 1%; background:rgba(0, 1, 17, 0.75); border-radius:10px; } #free_shipping { float:left; width:100%; text-align:center; border-radius:5px; background:#555; color:#fff; margin-bottom:10px; } #home_buttons a { float:left !important; max-width:32.8%; margin:0 0.5% 0 0; padding:0px !important; background:red; clear:none !important; } .link_button_large { float:left !important; max-width:49% !important; margin:0px 2% 0px 0px; clear:none; } .link_button_large:last-of-type { margin:0px; } .home_button_small { float:left; max-width:100%; } .home_button_small:last-of-type { margin-right:0%; } I have 11 news then i want to display like first column need only one news second column need 5 news third column need the rest of 5 news I tried this but no luck, it shows first column and second column and the rest outside column
$rows = array( 'Title1', 'Title2', 'Title3', 'Title4', 'Title5', 'Title6', 'Title7', 'Title8', 'Title9', 'Title10', 'Title11', ); $total_rows = count($rows); $total_cols = $total_rows - 1;// remove first one for the first column $left_column = ceil($total_cols / 2); $right_column = $total_cols - $left_column; $i = 0; foreach ($rows as $row) { $i++; if ($i == 1) { $class = "primary_post"; echo "<div class='col-md-4 main'>"; } elseif ($i <= $left_column) { $class = "other_post"; echo "<div class='col-md-4 left'>"; } elseif ($i == $right_column) { $class = "other_post"; echo "<div class='col-md-4 right'>"; } else { $class = "other_post"; } echo "<div class='card {$class}'>$i</div>"; if ($i == 1 || $i == $left_column || $i == $right_column) { echo "</div>"; } else { echo ""; } } echo "</div>";
Hey guys I've been reading the manual for zend framework 2...I under stand the layout helper...but a bit confused on where and when you would use the view to render and set variables? Would it be when you've disabled the layout helper and not wanting to include header, footer, side menus etc? Hope my question is clear and someone can explain when you would use the view instead of the layout helper This topic has been moved to HTML Help. http://www.phpfreaks.com/forums/index.php?topic=350182.0 I've made a template system, but the way I've chosed to do it doesn't give me the ability to choose a design. I've posted the code below with a bad solution for my design problem. Does anyone have any suggestions how to make a very simple and smart templatesystem? I don't have any problems coding. I just need ideas :-) Code: [Select] <?php final class View implements IView { protected $filename, $variables = array(); public function __construct($filename = null, $variables = array()) { $this->filename = $filename; $this->variables = $variables; } public function __toString() { if(!file_exists($this->filename)) { throw new Exception("View does not exists."); } $content = file_get_contents($this->filename); foreach($this->variables as $variable => $value) { $content = str_replace("#{{$variable}}", $value, $content); } return str_replace("#{content}", $content, file_get_contents("design.html")); } } ?> I have been trying to work out how to get my results into a 3 column layout using css and not using tables in any way. I found the code for tables: echo '<table>'; $counter = 0; $cells_per_row = 3; while($row=mysql_fetch_array($result)) { $counter++; if(($counter % $cells_per_row) == 1) { echo '<tr>'; } echo '<td>' . (whatever you echo from your $row array) . '</td>'; if(($counter % $cells_per_row) == 0) { echo '</tr>'; } } // just in case we haven't closed the last row // this would happen if our result set isn't divisible by $cells_per_row if(($counter % $cells_per_row) != 0) { echo '</tr>'; } echo '</table>'; How Can I adapt this or how should I use divs here? I am fine with the css code, just need to work out how to get the 3 column layout correct in the loop. 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 Hi everyone, I'm having real problems trying to retrieve database records in a 3 column layout, I got there eventually with a huge amount of help. Unfortunately the code will only display records that are divisable by by three; for example for a database table that has 45 records there is no problem, as all records can be displayed in a 3 column layout. However if the table contains 47 records it won't display the 2 odd records. My php skills are limited so I need all the help I can get. I'm a bit desperate to sort this out for a project I'm doing, any help would be greatly appreciated - here is the php code: $total = count($records); $nocol = 3; $norows = $total / $nocol; for ($i=1; $i <= $norows; $i++) { $cell = 0; echo "<tr>"; for($col=1; $col <= $nocol; $col++) { echo "<td>"; if ($col == 1) { $cell += $i; echo '<strong class="navtext">'.$records[$cell - 1]['ret_name'].'</strong><br />'; echo $records[$cell - 1]['ret_add1'].'<br />'; echo $records[$cell - 1]['ret_add2'].'<br />'; echo $records[$cell - 1]['ret_town'].'<br />'; echo $records[$cell - 1]['ret_county'].'<br />'; echo $records[$cell - 1]['ret_pcode'].'<br />'; echo $records[$cell - 1]['ret_phone'].'<br />'; echo $records[$cell - 1]['ret_email'].'<br />'; echo $records[$cell - 1]['ret_web'].'<br />'; } else { $cell += $norows; echo '<strong class="navtext">'.$records[$cell - 1]['ret_name'].'</strong><br />'; echo $records[$cell - 1]['ret_add1'].'<br />'; echo $records[$cell - 1]['ret_add2'].'<br />'; echo $records[$cell - 1]['ret_town'].'<br />'; echo $records[$cell - 1]['ret_county'].'<br />'; echo $records[$cell - 1]['ret_pcode'].'<br />'; echo $records[$cell - 1]['ret_phone'].'<br />'; echo $records[$cell - 1]['ret_email'].'<br />'; echo $records[$cell - 1]['ret_web'].'<br />'; } echo"</td>"; } echo"</tr>"; } I'm also trying to paginate the results, is this actually possible when using a three column layout? I look forward to any suggestions. This topic has been moved to CSS Help. http://www.phpfreaks.com/forums/index.php?topic=306024.0 This topic has been moved to Application Frameworks. http://www.phpfreaks.com/forums/index.php?topic=352167.0 hello all, i have ran into another issue i get this message when i go onto my homepage Notice: Undefined variable: layout in i have the following includes on the main index page: Code: [Select] <?php // Include Main Core File. include '_class/core.php'; // Include Config File include 'config/config.php'; include 'config/db.php'; // Use Database $obj->connect(); // Include library include '_class/library.php'; // Include layout include 'layout/index.php'; ?> on the config file i have the varible it is refering too: Code: [Select] <?php $layout = $url . "layout/"; ?> the actual file i get the error on (library.php) Code: [Select] <?php class library extends core { function advert() { /* * Name your images 1.jpg, 2.jpg etc. * * Add this line to your page where you want the images to * appear: <?php include "randomimage.php"; ?> */ // Change this to the total number of images in the folder $total = "2"; // Change to the type of files to use eg. .jpg or .gif $file_type = ".png"; // Change to the location of the folder containing the images $image_folder = $layout . "layout/images/adverts"; // You do not need to edit below this line $start = "1"; $random = mt_rand($start, $total); $image_name = $random . $file_type; echo "<img src=\"$image_folder/$image_name\" alt=\"$image_name\" />"; } } $obj = new library; ?> is there a way to make it so it $layout works on any page or file as long as its in the includes? thanks again. |