schilly
Members-
Posts
870 -
Joined
-
Last visited
Never
Everything posted by schilly
-
what type are 'topics' and 'posts'? are they integers?
-
yea could change that to whatever you want.
-
the function.php file is needed as that is where you define your get_xml_ functions as well as include the template.php file. basically you are now passing in the variable you need to call the specific get_xml_ function. so face.php passes "face" into the function. "face" which is now defined as $area in the function gets concatenated to get_xml_$area = get_xml_face and therefore calls the appropriate function defined in the function.php file. hope that makes sense. i'm not the best at explaining.
-
see my file. [attachment deleted by admin]
-
so did this work?
-
Just do everything in your query. $sql = "UPDATE bidding SET status = 'OPEN' WHERE acc_rej = 'accepted' AND acc_rej_timestamp <= DATE_SUB(NOW() INTERVAL 24 HOUR)"; that should work.
-
my stylesheet not displaying correct for my oop php
schilly replied to tomb04's topic in PHP Coding Help
this wont work: echo(" <link href="/stylesheet/main.css" media="all" rel="stylesheet" type="text/css"/>"); you need to escape your quotes or use single quotes inside double quotes. see my first post. change that line then see what error you get. -
looks like your form isn't posting as all your variables are empty. add print_r($_POST); at the top to make sure you actually have form data coming in. you probably also want to put that block in an if statement so it doesn't execute when there is no form data. if($_POST['submit_button_name']){//form code here}
-
you have an email address in the $to variable and also your $headers variable. if you look at the headers of your email you will see two TO: fields.
-
my stylesheet not displaying correct for my oop php
schilly replied to tomb04's topic in PHP Coding Help
whats the head code its outputting? -
ah k i see it now in functions.php. looks good.
-
it should. where are you including templates.php in face.php? [attachment deleted by admin]
-
my stylesheet not displaying correct for my oop php
schilly replied to tomb04's topic in PHP Coding Help
you need to escape your quotes change echo(" <link href="stylesheet/main.css" media="all" rel="stylesheet" type="text/css"/>"); to echo(" <link href=\"stylesheet/main.css\" media=\"all\" rel=\"stylesheet\" type=\"text/css\"/>"); or echo(" <link href='stylesheet/main.css' media='all' rel='stylesheet' type='text/css'/>"); -
crap your right. i usually have my counter at the start of the loop so it does work. your code however, isn't exactly what he wants as you only get one column per table. also for even rows you will get a double closing table tag. mjdamato's looks nice though. might have to steal =)
-
because you close off and add the table data every two rows, if you have an odd number of rows the table won't be completed. you need another loop after your main loop to check for this case. $i=1; foreach($listAI as $ai) { echo $i . ':'; $ai_name .= '<td width="175">' . $ai->ai_name . '</td>'; $ai_nie .= '<td width="175">' . $ai->ai_nie . '</td>'; $ai_address .= '<td width="175">' . $ai->ai_address . '</td>'; $ai_loc .= '<td width="175">' . $ai->ai_city. ' '.$ai->ai_state. ', ' .$ai->ai_zip . '</td>'; if($i==1){ $aiOutput .= '<table width="100%" border="0" cellspacing="0" cellpadding="0" style="font-size:8pt;">'; } if ($i%2==0) { $aiOutput .= '<tr>'. $ai_name . '</tr> <tr>' . $ai_nie .'</tr> <tr>'. $ai_address . '</tr> <tr>' . $ai_loc . '</tr>'; $aiOutput .= '</table><hr />'; $i=1; $ai_name = ''; $ai_nie = ''; $ai_address = ''; $ai_loc = ''; } $i++; } while($i %2 != 0){ $aiOutput .= '<tr>'. $ai_name . '</tr> <tr>' . $ai_nie .'</tr> <tr>'. $ai_address . '</tr> <tr>' . $ai_loc . '</tr>'; $i++; } $aiOutput .= '</table>';
-
ah good call. grucker give that a try. should work.
-
can't you add a variable into the function name to make it a dynamic function call?
-
The $area variable depends on whatever page you are calling the function. instead of <?= render_products_from_FACE();?> just use <?= render_products('face');?> just make sure to include the function before the call.
-
function render_products($area) { $output = "<table class='products'><tr>"; $i = 0; foreach (get_xml_$area() as $product) { $output .= ' <td valign="top"> <b class="b1h"></b><b class="b2h"></b><b class="b3h"></b><b class="b4h"></b> <div id="' . $product->id . '" class="product"> <div class="productdescription_face"> <h3>' . $product->title . '</h3> <br/> <p style="text-align:center;"> <img src="' . $product->img . '" alt="'.$product->alt.'" /></p> <p>' . $product->description . '</p> </div> <div style="margin-bottom:15px"> <p><b>' . $product->info . ' </b></p> </div> <div class="price"> <p><b>' . $product->size . ' £' . $product->price .'</b></p> </div> <div class="addToCart"> <form action="../addToCart.php" method="post"> <p> <input type="hidden" name="id" value="'.$product->id.'" /> <input class="red" type="submit" value="Add To Shopping Basket" /> </p> </form> </div> </div> <b class="b4bh"></b><b class="b3bh"></b><b class="b2bh"></b><b class="b1h"></b> </td> '; if ($i >= 2){ // start new row $output .= "</tr><tr>"; // reset loop $i = 0; } else $i++; } if ($i == 1) $output .= '<td></td><td></td>'; else if ($i == 2) $output .= '<td></td>'; $output .= '</tr></table>'; return $output; } that should work. pass in the variable depending on what page it's on. ie. render_products("face"); now you can put the whole function in an include.
-
check the data in the db. if it has too many slashes to escape quotes etc then there is a problem when you are entering the data into the db.
-
ok so the only difference is the function name and the xml call?
-
cant find the error in my code, needle in a haystack
schilly replied to silverglade's topic in PHP Coding Help
np. always helps to have a second set of eyes. -
you mean like function render_products_from_BODY() { $output = "<table class='body'><tr>"; $i = 0; foreach (get_xml_face() as $body) {