Jump to content

betsy_ls

Members
  • Posts

    11
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

betsy_ls's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I am trying to make a news bar like Xerox has (at the bottom of the page) http://www.xerox.com/. Are they using Ajax to call the php script?
  2. I am not sure if this is the correct forum to post this on. If not, I apologize. I am still pretty new to PHP. I am editing a website for a friend. He had a news headlines section on his home page, but wants to change it to a news bar that scrolls through the most recent news on their database. I have been searching for help online for this and have felt like I was close, but never quite found what I needed (especially since I am new to this). I found this tutorial (http://www.dynamicdrive.com/dynamicindex2/crosstick.htm), which is what I want... except that I don't want to use an Array for the headlines, but I want it to pull from my database. Is there an easy way for me to do this? I already have a php file from the previous news headlines section, but am not sure how to get that to work with this new code. Here is the code for the previous headlines... <div id="news"> <?php getHeadlines(); /* include("admin/nCMS/nSQL.php"); $db = new nSQL("local"); $q = "SELECT nDate, nTitle FROM `gtt_news` ORDER BY nDate DESC LIMIT 5;" $r = $db->select($q); while($data = $db->get_row()) { echo "<div class=\"newsitem\">"; echo "<p class=\"text\"><a href=\"#\">.$data['nTitle'].</a></p>"; echo "</div>"; } */ ?> </div> Please let me know if any other code is needed. Thanks so much for your help.
  3. Thanks! That worked. Now, I was wondering how you keep the information they have already entered into the form when the error message comes up... so they don't have to type everything in again.
  4. When I use that code I get this error... Parse error: syntax error, unexpected T_IS_NOT_EQUAL in /data/17/1/152/115/1804278/user/1953870/htdocs/subscribe.php on line 79 This is line 79... if ($_POST['firstname'])!="") {
  5. I am trying to edit a form so that certain fields are required to submit. I am very, very new to PHP though and am not sure how to do this. The form already makes sure there is a valid email, but I also want the first name, last name and organization to be required. Here is my PHP code. <?php if(isset($_POST['submitform']) && $_POST['submitform']==1) { if(isset($_POST['email']) && eregi("^[A-Za-z0-9](([_\.\-]?[a-zA-Z0-9]+)*)@([A-Za-z0-9]+)(([\.\-]?[a-zA-Z0-9]+)*)\.([A-Za-z]{2,})$", $_POST['email'])) { $to = "info@gttgrp.com"; $subject = "GTT FORM SUBMISSION"; $headers = "From: ".$_POST['email']; $date = date("r"); $message = "Form submission sent from 'Subscribe' at ".$date."\n\n"; $message .= "Salutation : ".$_POST['salutation']."\n"; $message .= "First Name : ".$_POST['firstname']."\n"; $message .= "Last Name : ".$_POST['lastname']."\n"; $message .= "Company : ".$_POST['organization']."\n"; $message .= "Title : ".$_POST['title']."\n\n"; $message .= "Country : ".$_POST['country']."\n\n"; $message .= "Phone : ".$_POST['phone']."\n"; $message .= "Email : ".$_POST['email']."\n\n"; if(isset($_POST['addtonetwork']) && $_POST['addtonetwork']=='yes') { $message .= "YES - Add to network.\n\n"; } else { $message .= "NO - Do not add to network.\n\n"; } if(mail($to, $subject, $message, $headers)) { include("includes/thankyou.php"); } else { global $error; $error = "Mail could not be sent!"; include("includes/form_subscribe.php"); } } else { global $error; $error = "You must submit a valid E-Mail."; include("includes/form_subscribe.php"); } } else { include("includes/form_subscribe.php"); } ?> Please let me know if you need any other code. I have been reading tutorials about this all day, but I do not know enough PHP to be able to apply it to the code I am editing. Thanks!
  6. Thank you ldb358. I hope this is the code you want. <?php include("includes/nSiteSQL.php"); include("admin/common/print_array.php"); function getHeadlines() { $newsheadlines = array(); $db = new nSQL(); $q = "SELECT ID, date_format(nDate, '%m.%d.%Y') as nDateF, nTitle, nDate FROM `gtt_news` ORDER BY `nDate` DESC LIMIT 5;"; $db->select($q); while($data = $db->get_row(MYSQL_NUM)) { $key = $data[3] . "news"; $newsheadlines[$key] = $data; $newsheadlines[$key][4] = "news"; } $new = array_merge($newsheadlines); krsort($new); $count = 0; foreach($new as $key => $val) { if($count<3) { $type = $val[3]; if($type == 'blog') { $link = "blogarchive.php?blogID=".$val[0]; } else { $link = "newsarchive.php?newsID=".$val[0]; } echo "<div class=\"newsitem\">"; echo "<p class=\"date\">".$val[1]."</p>"; echo "<p class=\"text\">".$val[2]."</p>"; echo "<p class=\"text\"><a href=\"$link\">read more</a></p>"; echo "</div>"; $count++; } } } ?> Also, I tried the code you posted, but it didn't work. Where am I supposed to put it. Remember I know very little php.
  7. I know very little PHP, but am trying to help out a friend by editing some of theirs. They have a news section on their home page that lists the titles of the 3 most recent news items. My friend wants to limit the number of characters that are displayed with "..." at the end. Here is the code for the news section... <div id="sideheadlines"> <p class="title">News</p> <?php getHeadlines(); /* include("admin/nCMS/nSQL.php"); $db = new nSQL("local"); $q = "SELECT nDate, nTitle FROM `gtt_news` ORDER BY nDate DESC LIMIT 5;"; $r = $db->select($q); while($data = $db->get_row()) { echo "<div class=\"newsitem\">"; echo "<p class=\"date\">".$data['nDate']."</p>"; echo "<p class=\"text\">".$data['nTitle']."</p>"; echo "<p class=\"text\"><a href=\"#\">Read More</a></p>"; echo "</div>"; } */ ?> </div> Please let me know if you need me to post anymore code. Thanks!
  8. Ta dah!!! It worked. Thank you so much for you help.
  9. I tried that, but it is not working. Maybe I am not doing it correctly. What am I supposed to change in the above CSS?
  10. I am extremely new to PHP and am not sure if I am even posting this in the correct place. Please forgive me if I don't explain this the right way. I am helping out a friend by editing his website that someone else wrote. The website has a top navigation dropdown menu. He wants the active page link to be a different color than the others (the same color as the hover). This is a link to the website... http://66.147.242.84/~gttgrpco/htdocs/index.php Here is the css for the navigation menu... #nav_box { color:white; background:white; width:851px; padding:1em 3em 1em 3em; height:2.25em; clear:both; float:left; } .menu { width:100%; height:2.25em; background:transparent; float:left; } .menu ul { padding:0; margin:0; } .menu ul li { float:left; width:14%px; display:inline; position:relative; list-style: none; } .menu ul li a, .menu ul li a:visited { display:block; text-decoration:none; font-weight:normal; color:#555555; padding:.25em 1em 0 1em; border-top: 1px silver solid; border-bottom: 1px silver solid; font-size: .9em; line-height:2.25em; } .menu ul ul { display: none; position:absolute; } .menu ul li:hover a, .menu ul li a:hover, .active{ color:#336699; } .menu ul li:hover ul{ display:block; position:absolute; float:left; width:100%; margin-top:.2em; margin-left:2em; padding-left:1em; font-size: .9em; top:2.5em; border-bottom: 1px silver solid; border-left: 1px silver solid; border-right: 1px silver solid; background:white; color:white; } .menu ul li:hover ul li a{ background:white; display:block; border:0; margin:0; color:#555555; font-size:1em; height:auto; line-height:1em; padding:5px; width:10em; } .menu ul li:hover ul li a:hover{ color:#336699; } And here is the php code from the navigation file... <?php $str = "<div id=\"nav_box\">\n"; $str .= "<div class=\"menu\">\n"; $pages = array('index'=>' HOME ', 'about_nogo'=>' ABOUT US ', 'services_nogo'=>' SERVICES ', 'press_nogo'=>' PRESS ', 'portfolios'=>' PORTFOLIOS ', 'contact_nogo'=>' CONTACT US ', 'innovators'=>' INVENTORS '); $pages_about = array('culture'=>'Our Culture','team'=>'Management Team','technology'=>'Technology Focus','blog'=>'Blog'); $pages_services = array('patent_sales'=>'Patent Asset Sales','patent_acquisition'=>'Patent Acquisition','patent_valuation'=>'Patent Valuation','services'=>'Other Services'); $pages_press = array('news'=>'Press Releases', 'events'=>'Events'); $pages_contact = array('headquaters'=>'Headquaters', 'email'=>'Email Us'); foreach($pages_about as $key=>$val){ if($page == $key) {$top = 'about';}} foreach($pages_services as $key=>$val){ if($page == $key) {$top = 'services';}} foreach($pages_press as $key=>$val){ if($page == $key) {$top = 'press';}} foreach($pages_contact as $key=>$val){ if($page == $key) {$top = 'contact';}} foreach($pages as $key => $val) { $str .= "<ul>\n"; if($page == $key) { $str .= "<li><a href=\"$key.php\" class=\"active\">".$val."</a>\n</li></ul>\n"; } else { if(eregi(( '([a-z]+)_nogo'), $key, $info)) { if ($top == $info[1]) { $str .= "<li><a href=\"#nogo\" class=\"active\">".$val."</a><ul>\n"; } else { $str .= "<li><a href=\"#nogo\">".$val."</a><ul>\n"; } foreach(${'pages_' . $info[1]} as $key => $val) { $str .= "<li><a href=\"".$key.".php\">".$val."</a></li>\n"; } $str .= "</ul></li></ul>\n"; } else { $str .= "<li><a href=\"$key.php\">".$val."</a></li></ul>\n"; } } } echo $str; ?> </div> </div> I understand most of the css, but the php is like a foriegn language to me. Thanks for your help. Please let me know if you need anything else. Betsy
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.