
bgbs
Members-
Posts
114 -
Joined
-
Last visited
Everything posted by bgbs
-
I understand your point, I'm merely saying that to understand php you have to understand the big picture. Learning programming language isnt the same as learning a real language (I'm fluent in three of them). Programming comprehension is like math comprehension, if you didn't get the logic, even though you know the formula memorized, you are duped.
-
I'm a designer by trade, when it come to php things go down from there. The problem with php, you dont even know where to start learning it. Every book starts with useless "hello world" statement, when in the real world you are faced with the database, arrays, and the whole infrastructure problems and equations to deal with. I dont know if anybody starts learning php with simple php commands, in the realworld, if you dont grasp the big picture in 10 minutes you are lost in translation.
-
there is like millions of files in this wordpress directory, I'm not sure which one of those files takes care of the sql queries.
-
I did, but I had no idea where to start implementing it. I'm like the php newb. Do I just put your code in place of all that php code?
-
Now it doesnt output title at all, you can see it in the live link. This makes me wonder now, if I will ever be able to learn php.
-
here is the live page http://wassociation.com/news/ If you move down to "Site New" and "Polls" section, that is how the actual output should be
-
Well, it rendered without any parse errors But it's output is wrong. For example: This supposed to output title only: But it gives me perma link and then the Title. And when it outputs the title, it disregards all css because of that. http://wassoc.com/news/2009/11/dell-confirms-android-smart-phone-specs-still-secret/Dell Confirms Android Smart Phone, Specs Still Secret This is being output correctly By Charlie Sorre Source: Wired Dell has, at long last, confirmed its intentions to get into the smartphone market. The company’s... This output is incorrect also. "Read the story" is the link, but clicking on it doesn't take you to the actual story. It should display date and "Read the Story" link only. But it displays perma link too. November 14, 2009http://wassoc.com/news/2009/11/dell-confirms-android-smart-phone-specs-still-secret/ | Read the story »
-
that worked now the error ended at endwhile; ?> line 31
-
After adding the semicolon it's getting close, we moved one line down, now the parse error is at line 26 for some reason echo '<p>'.the_time('F j, Y').' | <a href=".'the_permalink().'" rel="bookmark">Read the story »</a></p>'; <?php $recent = new WP_Query("cat=1&showposts=6"); $i = 0; while($recent->have_posts()) : $recent->the_post(); if($i == 0){ echo '<h1><a href="'.the_permalink().'" rel="bookmark">'.the_title().'</a></h1>'; if (function_exists('the_content_limit')){ the_content_limit(195, "<span class='read-more'>Read more »</span>"); } }else{ echo '<h4><a href="'.the_permalink().'" rel="bookmark">'.the_title().'</a></h4>'; the_content_limit(130, ""); echo '<div class="hppostmeta">'; echo '<p>'.the_time('F j, Y').' | <a href=".'the_permalink().'" rel="bookmark">Read the story »</a></p>'; echo '</div>'; } echo '<div style="clear:both;"></div>'; $i++ endwhile; ?>
-
I appreciate your help ... now the parse error moved down to line 25 echo '<div class="hppostmeta">'; doesnt seem anything wrong here to me
-
yeah that is what I did, but I'm getting the parse error. line 18 in home.php page is echo <h1>....</h1> line <?php $recent = new WP_Query("cat=1&showposts=6"); $i = 0; while($recent->have_posts()) : $recent->the_post(); if($i == 0){ echo '<h1><a href="'.php the_permalink().'" rel="bookmark">'.php the_title().'</a></h1>'; if (function_exists('the_content_limit')){ the_content_limit(195, "<span class='read-more'>Read more »</span>"); } }else{ echo '<h4><a href="'.php the_permalink().'" rel="bookmark">'.the_title().'</a></h4>'; the_content_limit(130, "") echo '<div class="hppostmeta">'; echo '<p>'.the_time('F j, Y').' | <a href=".'php the_permalink().'" rel="bookmark">Read the story »</a></p>'; echo '</div>'; } echo '<div style="clear:both;"></div>'; $i++ endwhile; ?>
-
You want me to enclose this whole code in one php bracket? If I paste your code I get the infamous parse error Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /home/wasc/public_html/news/wp-content/themes/news/home.php on line 18
-
On my homepage I have a list of latest blog posts showing. The first post is the latest one with a big picture, and the older ones go down just as regular posts. Well the problem is, the regular list posts also show the first post, and its a nag for me because it is a duplicate that I wish it would not be there since it is already showing as the Big Latest Story. How can I modify the code to not to repeat the latest story twice? This is the code that puls the latest story <?php $recent = new WP_Query("cat=1&showposts=1"); while($recent->have_posts()) : $recent->the_post();?> <h1><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h1> <?php if (function_exists('the_content_limit')) { the_content_limit(195, "<span class='read-more'>Read more »</span>"); } ?> <div style="clear:both;"></div> <?php endwhile; ?> And this is the next code that show the 5 recent stories as regular posts. I would like the first one from that recent list ommitted some how, but I dont know how to do that. <?php $recent = new WP_Query("cat=1&showposts=5"); while($recent->have_posts()) : $recent->the_post();?> <h4><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h4> <?php the_content_limit(130, ""); ?> <div class="hppostmeta"> <p><?php the_time('F j, Y'); ?> | <a href="<?php the_permalink() ?>" rel="bookmark">Read the story »</a></p> </div> <?php endwhile; ?><br />
-
oops, I guess it should have been $errors not $error Thanks guys, it works now. I appreciate your help.
-
originally I'm outputting it like this <?PHP echo $errors; ?> But, if I understand you correctly, you want me to out put like this: <?PHP echo "<div class='error-message'>" . $error ."</div>"; ?> which only outputs div
-
See, I dont understand any other language accept for english. I can do simple echo. But I dont know how to echo your statement, that is beyond my ability to understand.
-
You mean where I output the error? If I put this: <?PHP $error = "<div>" . $error . "</div>"; ?> then it doesnt work. the div box and Errors dont appear at all.
-
I would like to wrap all Error messages in one <div> block. Where do I began the DIV tag and where do I end it? if (!empty($_POST['action'])) { $action = $_POST['action']; $passwordExisting = $_POST['passwordExisting']; $passwordNew = $_POST['passwordNew']; $passwordConfirm = $_POST['passwordConfirm']; } if ($action == "change") { if (empty($passwordExisting) ) { $errors .= "<p>» You didn't enter your Existing Password</p>"; } if (empty($passwordNew)) { $errors .= "<p>» You didn't enter a New Password</p>"; } if (empty($passwordConfirm)) { $errors .= "<p>» You didn't enter a Confirmed New Password</p>"; } if ($passwordConfirm != $passwordNew) { $errors .= "<p>» Your New Password and Confirmed Password Do Not Match.</p>"; } $p_user = $db->get_row("SELECT first_name FROM user WHERE uvar = '$uvar' AND pass='$passwordExisting'"); if (empty($p_user->first_name)) { //password is wrong $errors .= "» You entered the wrong Exiting Password. <p><a href='../forgot.php'>If you forgot your existing password, click here.</a></p>"; } else { // user does exist, set cookie and redirect if (empty($errors)) { $db->query("UPDATE user SET pass = '$passwordNew' WHERE uvar = '$uvar'"); $success = "<div class='updated-message'>Your password has been changed.</div>"; $passwordExisting = ""; $passwordNew = ""; $passwordConfirm = ""; } }
-
nice. that was easy Thanks guys for your help TOPIC SOLVED
-
To the php statement below I would like to add one more option that if it does not meet any of the required member statuses that it would simply read FREE MEMBER. Is it possible to add that statement if we dont have mem_type_id set for free member in the database? <?PHP if($admin=="yes") { $cur_mem = $db->get_row("SELECT * FROM mem WHERE user_id = '$v_id'"); if($cur_mem->mem_type_id == 2) echo "<strong><span style=\"color: red; \">LIFETIME MEMBER</span></strong>"; elseif($cur_mem->mem_type_id == 3) echo " <strong><span style=\"color: red; \">6 MONTH MEMBER</span></strong>"; elseif($cur_mem->mem_type_id == 4) echo "<strong><span style=\"color: red; \">ANNUAL MEMBER</span></strong>"; elseif($cur_mem->mem_type_id == 6) echo "<strong><span style=\"color: red; \">MONTHLY MEMBER</span></strong>"; elseif($cur_mem->mem_type_id == 7) echo "<strong><span style=\"color: red; \">QUARTERLY MEMBER</span></strong>"; elseif($cur_mem->mem_type_id == 10) { echo "<strong><span style=\"color: red; \">EXPIRED MEMBER</span></strong>"; if($cur_mem->renew_refused == "Yes") echo "<br /><span style=\"color:red\">Renewal refused</span> ".$cur_mem->refused_date; } }?>
-
[SOLVED] Can someone Tell me whats wrong with this script?
bgbs replied to bgbs's topic in PHP Coding Help
Lately I had to solve my own bugs on this forum using alternative methods. -
If you go towards the bottom and look at the <?php if ($_SESSION['group'] == "admin") { if ($value[11] == "") { echo "[<a href=\"#\" onClick=\"javascript:CloseBug('".date($dateformat)."')\">Close bug</a>]</td></tr>"; } else { echo "[<a href=\"#\" onClick=\"javascript:ReopenBug()\">Reopen bug</a>]</td></tr>"; } } ?> When you click on the CLOSE BUG link it does not input date into the field. It should be able to do that. Your help is appreciated. Thanks <?php if (!$allowed) { include("./footer.php"); } ?> <?php if ($_SESSION['user_id'] == "") { include("./footer.php"); } ?> <?php if (!empty($_GET['bug_id']) && $_SESSION['group'] != "admin") { include("./footer.php"); } ?> <?php if (!empty($_GET['bug_id'])) { echo "<h1>Edit bug</h1>"; $bug_id = $_GET['bug_id']; $record = OpenRecord("bug", "*", "id+=".$bug_id, "", "false"); // read bug details $value = explode($delimiter, $record[0]); $value[12] = br2nl($value[12]); } else { echo "<h1>Add bug</h1>"; $value[10] = date($dateformat); $value[8] = "1"; $value[4] = $_SESSION['project_id']; $value[9] = $_SESSION['user_id']; } ?> <form name="bugform" method="POST" action="index.php?page=bug_store"> <table class="datatable" width="60%"> <input type="hidden" name="bug_id" value="<?php echo $value[0]; ?>"> <tr><th>Bug title*:</th><td><input name="name" type="text" size="40" maxlength="40" value="<?php echo $value[1]; ?>"></td></tr> <tr><th>Severity:</th><td><?php FillPulldown("severity", $value[2]); ?></td></tr> <tr><th>Priority:</th><td><?php FillPulldown("priority", $value[3]); ?></td></tr> <input type="hidden" name="project_id" value="<?php echo $value[4]; ?>"> <tr><th>Type:</th><td><?php FillPulldown("type", $value[6]); ?></td></tr> <tr><th>Status:</th><td><?php FillPulldown("status", $value[8]); ?></td></tr> <input type="hidden" name="user_id" value="<?php echo $value[9]; ?>"> <tr><th>Opened:</th><td><input name="opendate" type="text" size="40" maxlength="40" readonly value="<?php echo $value[10]; ?>"></td></tr> <tr><th>Closed:</th><td><input name="closedate" type="text" size="40" maxlength="40" readonly value="<?php echo $value[11]; ?>"> <?php if ($_SESSION['group'] == "admin") { if ($value[11] == "") { echo "[<a href=\"#\" onClick=\"javascript:CloseBug('".date($dateformat)."')\">Close bug</a>]</td></tr>"; } else { echo "[<a href=\"#\" onClick=\"javascript:ReopenBug()\">Reopen bug</a>]</td></tr>"; } } ?> <tr><th>Description*:</th><td><textarea name="description" cols="50" rows="10" maxlength="200"><?php echo $value[12]; ?></textarea></td></tr> <?php if (!empty($_GET['bug_id'])) { echo "<tr><th>Message:</th><td><textarea name=\"message\" cols=\"50\" rows=\"10\" maxlength=\"200\"></textarea></td></tr>"; } ?> </table> <br /> <input type="submit" value="Save bug"> (* = fields you must fill in) </form>
-
I would like someone to help me figure out this echo bug with DIV. The code below is a feedback block. When there is feedback left for the user, then echo div gets added and it screws up all my css as a result. This div is an extra element that should be wrapper correctly. If I simply remove the echo DIV it messes CSS another way. So I think there I need to add begging div somewhere else above in the code. I dont know enough about PHP coding to be able to fix this problem. Your help is appreciated. <div class="account-left-column"><div><img src="images/account-left-column-back-top.gif" alt="" /></div><div class="account-left-column-header">FEEDBACK for <?PHP echo $vuser->first_name; ?></div> <div class="account-left-column-content"> <?PHP $feedback = getFeedback($v_id,"to"); if (count($feedback) > 0) { $counterstart = 0; foreach ($feedback as $fback) { $counterstart++; if($counterstart % 2) {$feedbackstyle = "background-color:#fff";} else {$feedbackstyle = "background-color:#fff";} echo '<div style="padding:5px 5px 5px 5px;'.$feedbackstyle.'">'; echo "<a href='user.php?v_id=$fback->co_user_id'>$fback->first_name $fback->last_name ($fback->co_name)</a> rated <strong>$fback->message_rating/5</strong> <div class='feedback-message'>\"$fback->message\" (".substr($fback->message_date,0,10).") </div>"; //resolution of feedback $current_user_id = currentUserID(); if ($current_user_id == $v_id) { // the person that is viewing the feedback, is the same as the for who the feedback was left for // so we can display the resolve feedback link echo "<a href='feedback_resolve.php?feedbackid=$fback->feedback_id'><font color=red>Click to resolve this feedback.</font></a>"; } echo "</div>"; } } else { echo "<p>No feedback for this user</p>"; } ?> <?PHP if ($current_user_id != $v_id) { //don't allow people to leave feedback for themselves ?> <div class="account-button"><a href="feedback.php?to_id=<?PHP echo $v_id; ?>">Leave feedback for <?PHP echo $vuser->first_name; ?></a> <?PHP } ?> </div> </div> <div><img src="images/account-left-column-back-bottom.gif" alt="" /></div></div> <!--<end of .account-left-column>-->
-
wow, you're a genius