Jump to content
xisto Community

dsjoes

Members
  • Content Count

    18
  • Joined

  • Last visited

1 Follower

About dsjoes

  • Rank
    Newbie [Level 1]
  1. i think it might be this part of the sagscroller.js init:function($){ var setting=this.setting this.$loadingpanel.hide() this.$mainul=this.$slider.find('ul:eq(0)').css({zIndex:1000}) this.$lis=this.$mainul.find('li') if (setting.navpanel.show) this.addnavpanel() this.$secul=this.$mainul.clone().css({top:this.$mainul.height(), zIndex:999}).appendTo(this.$slider) //create sec UL and add it to the end of main UL this.scrollmsg(setting.mode=="auto") },
  2. i have got the code below it is for a scroll box and i have added the php part of it so that i can change the text from the admin page. the problem is that the scroller code is duplicating the text so it shows twice. how do i stop it from happening. I think it is the javascript part that is causing the problem but i don't know where or which part. scroller.php <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://forums.xisto.com/no_longer_exists/ xmlns="http://forums.xisto.com/no_longer_exists/ http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>Untitled Document</title><script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script><link rel="stylesheet" type="text/css" href="sagscroller.css" /><script src="sagscroller.js">/************************************************ SAG Content Scroller- © Dynamic Drive DHTML code library (http://www.dynamicdrive.com/)* Visit http://www.dynamicdrive.com/ for hundreds of DHTML scripts* This notice must stay intact for legal use***********************************************/</script><style type="text/css">div#mysagscroller{width: 200px; /*width of scroller*/height:250px;background:#FFF;}div#mysagscroller ul li{background:#FFFF48;color:Black;padding:5px;margin-bottom:5px; /*bottom spacing between each LI*/}div#mysagscroller ul li:first-letter{font-size:28px;background:#009fc6;color:white;padding:0 2px;margin-right:2px;}</style><script>var sagscroller1=new sagscroller({ id:'mysagscroller', mode: 'manual' //<--no comma following last option})</script></head><body><div id="mysagscroller" class="sagscroller"> <ul> <?php$con = mysql_connect("host","user","pass");if (!$con){die('Could not connect: ' . mysql_error());}mysql_select_db("group_news", $con);$result = mysql_query("SELECT * FROM News");while($row = mysql_fetch_array($result)){echo nl2br($row['News']);}mysql_close($con);?> </ul></div></body></html> sagscroller.js /*Sag Content Scroller (Aug 7th, 2010)* This notice must stay intact for usage * Author: Dynamic Drive at http://www.dynamicdrive.com/* Visit http://www.dynamicdrive.com/ for full source code*///Updated Aug 28th, 10 to v1.3var sagscroller_constants={ navpanel: {height:'16px', downarrow:'/pics/main/down1.gif', opacity:0.6, title:'Go to Next Content', background:'black'}, loadingimg: {src:'/pics/main/ajaxloading.gif', dimensions:[100,15]}}function sagscroller(options){ this.setting={mode:'manual', inittype:'stunted', pause:3000, animatespeed:500, ajaxsource:null, rssdata:null, refreshsecs:0, navpanel:{show:true, cancelauto:false}} //default settings jQuery.extend(this.setting, options) //merge default settings with options options=null this.curmsg=0 this.addloadingpanel(jQuery, 'preload') if (this.setting.rssdata) //if rss contents google.load("feeds", "1") //init google ajax api var slider=this jQuery(function($){ //on document.ready slider.$slider=$('#'+slider.setting.id) if (slider.setting.ajaxsource||slider.setting.rssdata) slider.$slider.empty() slider.addloadingpanel(jQuery, 'show') if (slider.setting.ajaxsource) //if ajax data slider.getajaxul(slider.setting.ajaxsource) else if (slider.setting.rssdata){ //if rss data slider.fetchfeeds() } else{ //if inline content if (slider.setting.inittype=="onload") //load scroller when page has completely loaded? $(window).load(function(){slider.init($)}) else //load scroller immediately and get dimensions progressively instead slider.init($) } })}sagscroller.prototype={ getajaxul:function(path){ var $=jQuery, slider=this this.stopscroll() //stop animation/ scrolling of slider, in the event this is a subsequent call to getajaxul() this.$loadingpanel.show() $.ajax({ url: path, //path to external content async: true, error:function(ajaxrequest){ slider.$slider.html('Error fetching content.<br />Server Response: '+ajaxrequest.responseText) }, success:function(content){ slider.reloadul(content) if (slider.setting.refreshsecs>0) //refetch contents every x sec? setTimeout(function(){slider.getajaxul(path)}, slider.setting.refreshsecs*1000) } }) }, addloadingpanel:function($, mode){ var loadingimgref=sagscroller_constants.loadingimg if (mode=="preload"){ var loadingimg=new Image(loadingimgref.dimensions[0], loadingimgref.dimensions[1]) loadingimg.src=loadingimgref.src this.$loadingimg=$(loadingimg).css({position:'absolute', zIndex:1003}) } else{ var sliderdimensions=[this.$slider.width(), this.$slider.height()] var $loadingpanel=$('<div />').css({position:'absolute', left:0, top:0, background:'black', opacity:0.5, width:sliderdimensions[0], height:sliderdimensions[1], zIndex:1002}).appendTo(this.$slider) this.$loadingimg.css({left:sliderdimensions[0]/2-loadingimgref.dimensions[0]/2, top:sliderdimensions[1]/2-loadingimgref.dimensions[1]/2}).appendTo(this.$slider) this.$loadingpanel=$loadingpanel.add(this.$loadingimg) } }, addnavpanel:function(){ var slider=this, setting=this.setting var $navpanel=$('<div class="sliderdesc"><div class="sliderdescbg"></div><div class="sliderdescfg"><div class="sliderdesctext"></div></div></div>') .css({position:'absolute', width:'100%', left:0, top:-1000, zIndex:'1001'}) .find('div').css({position:'absolute', left:0, top:0, width:'100%'}) .eq(0).css({background:sagscroller_constants.navpanel.background, opacity:sagscroller_constants.navpanel.opacity}).end() //"sliderdescbg" div .eq(1).css({color:'white'}).end() //"sliderdescfg" div .eq(2).css({textAlign:'center', cursor:'pointer', paddingTop:'2px'}).html('<img src="'+sagscroller_constants.navpanel.downarrow+'"/>').end().end() .appendTo(this.$slider) var $descpanel=$navpanel.find('div.sliderdesctext').attr('title', sagscroller_constants.navpanel.title).click(function(){ //action when nav bar is clicked on slider.stopscroll() slider.scrollmsg(setting.mode=="auto" && !setting.navpanel.cancelauto? true : false) }) $navpanel.css({top:this.$slider.height()-parseInt(sagscroller_constants.navpanel.height), height:sagscroller_constants.navpanel.height}).find('div').css({height:'100%'}) }, resetuls:function(){ //function to swap between primary and secondary ul var $tempul=this.$mainul this.$mainul=this.$secul.css({zIndex:1000}) this.$secul=$tempul.css({zIndex:999}) this.$secul.css('top', this.ulheight) }, reloadul:function(newhtml){ //function to empty out SAG scroller UL contents then reload with new contents this.$slider.find('ul').remove() this.ulheight=null this.curmsg=0; this.$slider.append(newhtml) this.init($) }, setgetoffset:function($li){ var recaldimensions=(this.setting.ajaxsource || this.setting.rssdata) && this.setting.inittype=="onload" //bool to see if script should always refetch dimensions if (this.curmsg==this.$lis.length) return (!this.ulheight || recaldimensions)? this.ulheight=this.$mainul.height() : this.ulheight else{ if (!$li.data('toppos') || recaldimensions) $li.data('toppos', $li.position().top) return $li.data('toppos') } }, scrollmsg:function(repeat){ var slider=this, setting=this.setting var ulheight=this.ulheight || this.$mainul.height() var endpoint=-this.setgetoffset(this.$lis.eq(this.curmsg)) this.$mainul.animate({top: endpoint}, setting.animatespeed, function(){ slider.curmsg=(slider.curmsg<slider.$lis.length+1)? slider.curmsg+1 : 0 if (slider.curmsg==slider.$lis.length+1){ //if at end of UL slider.resetuls() //swap between main and sec UL slider.curmsg=1 } if (repeat) slider.scrolltimer=setTimeout(function(){slider.scrollmsg(repeat)}, setting.pause) }) var secendpoint=endpoint+ulheight this.$secul.animate({top: secendpoint}, setting.animatespeed) }, stopscroll:function(){ if (this.$mainul){ this.$mainul.add(this.$secul).stop(true, false) clearTimeout(this.scrolltimer) } }, init:function($){ var setting=this.setting this.$loadingpanel.hide() this.$mainul=this.$slider.find('ul:eq(0)').css({zIndex:1000}) this.$lis=this.$mainul.find('li') if (setting.navpanel.show) this.addnavpanel() this.$secul=this.$mainul.clone().css({top:this.$mainul.height(), zIndex:999}).appendTo(this.$slider) //create sec UL and add it to the end of main UL this.scrollmsg(setting.mode=="auto") }, ///////////////////////RSS related methods below/////////////////// fetchfeeds:function(){ var slider=this, rssdata=this.setting.rssdata this.stopscroll() //stop animation/ scrolling of slider, in the event this is a subsequent call to fetchfeeds() this.$loadingpanel.show() this.entries=[] //array holding combined RSS feeds' entries from Feed API (result.feed.entries) this.feedsfetched=0 for (var i=0; i<rssdata.feeds.length; i++){ //loop through the specified RSS feeds' URLs var feedpointer=new google.feeds.Feed(rssdata.feeds[i][1]) //create new instance of Google Ajax Feed API feedpointer.setNumEntries(rssdata.entries) //set number of items to display feedpointer.load(function(label){ return function(r){ slider.storefeeds(r, label) } }(rssdata.feeds[i][0])) //call Feed.load() to retrieve and output RSS feed. } }, storefeeds:function(result, label){ var thisfeed=(!result.error)? result.feed.entries : "" //get all feed entries as a JSON array or "" if failed if (thisfeed==""){ //if error has occured fetching feed alert("Google Feed API Error: "+result.error.message) } for (var i=0; i<thisfeed.length; i++){ //For each entry within feed result.feed.entries[i].label=label //extend it with a "label" property } this.entries=this.entries.concat(thisfeed) //add entry to array holding all feed entries this.feedsfetched+=1 if (this.feedsfetched==this.setting.rssdata.feeds.length){ //if all feeds fetched if (this.setting.rssdata.groupbylabel){ //sort by label name? this.entries.sort(function(a,{ var fielda=a.label.toLowerCase(), fieldb=b.label.toLowerCase() return (fielda<fieldb)? -1 : (fielda>fieldb)? 1 : 0 }) } else{ //just sort by date this.entries.sort(function(a,{return new Date(b.publishedDate)-new Date(a.publishedDate)}) } this.formatfeeds() } }, formatfeeds:function(){ function formatdate(datestr, showoptions){ var itemdate=new Date(datestr) var parseddate=(showoptions.indexOf("datetime")!=-1)? itemdate.toLocaleString() : (showoptions.indexOf("date")!=-1)? itemdate.toLocaleDateString() : "" return "<span class='datefield'>"+parseddate+"</span>" } var sagcontent='<ul>' var slider=this, rssdata=this.setting.rssdata, entries=this.entries for (var i=0; i<entries.length; i++){ sagcontent+='<li><a href="'+entries[i].link+'" target="'+rssdata.linktarget+'">'+entries[i].title+'</a>' +'<div class="rsscontent">' +(/description/.test(rssdata.displayoptions)? entries[i].content : entries[i].contentSnippet) +'</div>' +'<div class="rsslabel">' +(/label/.test(rssdata.displayoptions)? "<b>Source("+(i+1)+"):</b> "+entries[i].label+" " : "") +(/date/.test(rssdata.displayoptions)? formatdate(entries[i].publishedDate, rssdata.displayoptions): "") +'</div>' +'</li>\n\n' } sagcontent+='</ul>' this.reloadul(sagcontent) if (slider.setting.refreshsecs>0) //refetch contents every x sec? setTimeout(function(){slider.fetchfeeds()}, slider.setting.refreshsecs*1000) }} it is also using the script from here as well http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js
  3. dsjoes

    Header Error

    thanks that worked
  4. dsjoes

    Header Error

    i get the below message when i try to use the script near the bottom which deletes from an sql database and the linked file but if i put the script on a page on it's own it works without a hitch. so it is something else on his page that is causing the problem i have tried removing everything but the main design but it is then indicating the error is because of the divs i have used and every time i remove the one it wants it changes to another. line 95 is this bit header('Location: index.php');and line ten is the stylesheet for uploadify <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://forums.xisto.com/no_longer_exists/ xmlns="http://forums.xisto.com/no_longer_exists/ http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>Testimonials</title><link href="../style.css" rel="stylesheet" type="text/css" /><link href="uploadify/uploadify.css" type="text/css" rel="stylesheet" /> <script type="text/javascript" src="uploadify/jquery-1.4.2.min.js"></script> <script type="text/javascript" src="uploadify/swfobject.js"></script> <script type="text/javascript" src="uploadify/jquery.uploadify.v2.1.4.min.js"></script> <script type="text/javascript"> $(document).ready(function() { $('#file_upload').uploadify({ 'uploader' : 'uploadify/uploadify.swf', 'script' : 'uploadify/uploadify.php', 'cancelImg' : 'uploadify/cancel.png', 'folder' : '../testimonial_files', 'auto' : true }); }); </script> </head><body><div class="container"> <div class="header"><br /><br /><br /> </div> <div class="sidebar1"> <ul class="nav"><b> <li><a href="../">Home</a></li> <li><a href="/admin/">Testimonials upload</a></li> <li><a href="audio/">Audio Testimonials upload</a></li> <li><a href="dvds/">Dvd's upload</a></li> <li><a href="newsletter/">Newsletter upload</a></li> <li><a href="news/">News box update</a></li> </b></ul></div> <div class="content"> <center><h2>Admin</h2></center> <br /><center><p><input id="file_upload" name="file_upload" type="file" /></p><p><table width="200" border="0"><form action="insert_test.php" method="post"> <tr> <td align="right">Name:</td> <td><input type="text" name="Name" /></td> </tr> <tr> <td align="right">Description:</td> <td><input type="text" name="Message" /></td> </tr> <tr> <td align="right">Download:</td> <td><input name="Download" type="text" /></td> </tr> <tr> <td colspan="2" align="center"><input type="submit" value="Submit" /></td> </tr></form></table></p><br /><br /><p><?php// Set Global Vars$HOST = "";$USERNAME = "";$PASSWORD = "";$DATABASE = "";$TABLE = "";// Establish a connectionmysql_connect($HOST, $USERNAME, $PASSWORD) or die(mysql_error());mysql_select_db($DATABASE) or die(mysql_error());//==================================================================// Check if anything is posted//==================================================================if (isset($_POST['delete'])) { $sql = ("delete from $TABLE where "); for ($i = 0; $i < count($_POST['checkbox']); $i++) { if ($i != 0) { $sql.= "OR "; } $sql .= " id='" . $_POST['checkbox'][$i] . "'"; //================================================================== // Select file to unlink based on id posted //================================================================== $sql_file_unlink = "select Download from $TABLE where id = {$_POST['checkbox'][$i]}"; $result_file_unlink = mysql_query($sql_file_unlink); $row_file_link = mysql_fetch_assoc($result_file_unlink); if($row_file_link) { unlink('../testimonial_files/' . $row_file_link['Download']); } //================================================================== } $result = mysql_query($sql); header('Location: index.php'); exit;} else { // select sql here $sql = "select * from `$TABLE` order by `id`;"; $result = mysql_query($sql);}?><table align="center" width="400" border="0" cellspacing="1" cellpadding="0"> <tr> <td colspan="6" align="center"><strong>Testimonials</strong> </td> </tr> <tr> <td><form name="delete" method="post" action="<?php echo $_SERVER['PHP_SELF'] ?>"> <table width="400" border="1" cellpadding="3" cellspacing="1"> <tr> <td align="center"><strong>Select</strong></td> <td align="center"><strong>ID</strong></td> <td align="center"><strong>Name</strong></td> <td align="center"><strong>Description</strong></td> <td align="center"><strong>Download</strong></td> <td align="center"><strong>Last Modified</strong></td> </tr><?php $row = mysql_fetch_assoc($result); ?><?php do { ?> <tr> <td align="center"> <input name="checkbox[]" type="checkbox" id="checkbox[]" value="<?php echo $row['id']; ?>"> </td> <td align="center"><?php echo $row['id']; ?></td> <td align="center"><?php echo $row['Name']; ?></td> <td align="center"><?php echo $row['Message']; ?></td> <td align="center"><a href="../testimonial_files/<?php echo $row['Download']; ?>">Download</a></td> <td align="center"><?php echo date("j/n/y", strtotime($row["Modified"])) ?></td> </tr> <?php } while ($row = mysql_fetch_assoc($result)); ?> <tr> <td colspan="6" align="center"><input name="delete" type="submit" id="delete" value="Delete"></td> </tr> </table> </form> </td> </tr> </table></p></center></div> <div class="sidebar2"> <h4>Text here</h4> <p> </p> </div> <div class="footer"> <center><p>Š Copyright 2010</p></center> </div> </div></body></html>
  5. i have tryed with the full file path i have fixed the table not displaying correctly it is just the unlink and the header problem that i am still having problems with. the unlink part is too high up the code because it gets the ['Download'] part from this bit <?php $row = mysql_fetch_assoc($result); ?><?php do { ?>
  6. that is now showing the data but it only shows the first row in the table the others are not in it i have attached a pic to show you what i mean and the description part is supposed to be empty i haven't put anything in it yet because of testing the unlink. untitled.bmp i have tryed the deleting bit but i get these two messages i have tryed with the full file path
  7. that gives me the message the script is supposed to let me delete a selected row from my sql database and also delete the file from the download column
  8. <?php// Set Global Vars$HOST = "XXXXXXX";$USERNAME = "XXXX";$PASSWORD = "XXXXX";$DATABASE = "XXXXX";$TABLE = "Testimonials";// Establish a connectionmysql_connect($HOST, $USERNAME, $PASSWORD) or die(mysql_error());mysql_select_db($DATABASE) or die(mysql_error());// Query for resultsif(!isset($_POST['delete'])) {$sql = "select * from `$TABLE` order by `id`;";} else {$DELETE_ID = mysql_real_escape_string($_POST['delete']);echo("select * from `$TABLE` where `id` = '$DELETE_ID';");die();// Delete the file on the diskunlink('../admin/testimonial_files/'.$row['Download']);// Build your query, kind of weird but alright.$sql = ("delete from $TABLE where ");for($i=0;$i<count($_POST['checkbox']);$i++){if($i != 0) { $sql.= "AND "; }$sql .= " id='" . $_POST['checkbox'][$i] . "'";}$result = mysql_query($sql);if(isset($_POST['delete'])) { header('Location: index.php');exit;}}?><table align="center" width="400" border="0" cellspacing="1" cellpadding="0"><tr><td><form name="delete" method="post" action="<?php echo $_SERVER['PHP_SELF'] ?>"><table width="400" border="1" cellpadding="3" cellspacing="1"><tr><td colspan="6" align="center"><strong>Testimonials</strong> </td></tr><tr><td align="center"><strong>Select</strong></td><td align="center"><strong>ID</strong></td><td align="center"><strong>Name</strong></td><td align="center"><strong>Description</strong></td><td align="center"><strong>Download</strong></td><td align="center"><strong>Last Modified</strong></td></tr><?php $row = mysql_fetch_assoc($result); ?><?php do { ?> <tr> <td align="center"> <input name="checkbox[]" type="checkbox" id="checkbox[]" value="<?php echo $row['id']; ?>"> </td> <td align="center"><?php echo $row['id']; ?></td> <td align="center"><?php echo $row['Name']; ?></td> <td align="center"><?php echo $row['Message']; ?></td> <td align="center"><a href="/admin/testimonial_files/<?php echo $row['Download']; ?>">Download</a></td> <td align="center"><?php echo $row['Modified']; ?></td> </tr> <tr> <td colspan="6" align="center"><input name="delete" type="submit" id="delete" value="Delete"></td> </tr></table></form></td></tr></table><?php } while($row = mysql_fetch_assoc($result)); ?> only messages i get are the ones i posted in the first post nothing new
  9. where do i put it i have tryed under the php but it doesn't echo anything
  10. nothing has changed it still shows the same messages
  11. These are the errors i keep getting this is the code <?php// Set Global Vars$HOST = "XXXXXXXX";$USERNAME = "XXXXXXXXXXXX";$PASSWORD = "XXXXXXXX";$DATABASE = "testdocs";$TABLE = "docs";// Establish a connectionmysql_connect($HOST, $USERNAME, $PASSWORD) or die(mysql_error());mysql_select_db($DATABASE) or die(mysql_error());// Query for resultsif(!isset($_POST['delete'])) {$sql = "select * from `$TABLE` order by `id`;";} else {$DELETE_ID = mysql_real_escape_string($_POST['delete']);$result1 = mysql_query("select * from `$TABLE` where `id` = '$DELETE_ID';");$row = mysql_fetch_assoc($result1);mysql_close($result1);// Delete the file on the diskunlink('../admin/testimonial_files/'.$row['Download']);// Build your query, kind of weird but alright.$sql = ("delete from $TABLE where ");for($i=0;$i<count($_POST['checkbox']);$i++){if($i != 0) { $sql.= "AND "; }$sql .= " id='" . $_POST['checkbox'][$i] . "'";}$result = mysql_query($sql);if(isset($_POST['delete'])) { header('Location: index.php');exit;}}?><table align="center" width="400" border="0" cellspacing="1" cellpadding="0"><tr><td><form name="delete" method="post" action="<?php echo $_SERVER['PHP_SELF'] ?>"><table width="400" border="1" cellpadding="3" cellspacing="1"><tr><td colspan="6" align="center"><strong>Testimonials</strong> </td></tr><tr><td align="center"><strong>Select</strong></td><td align="center"><strong>ID</strong></td><td align="center"><strong>Name</strong></td><td align="center"><strong>Description</strong></td><td align="center"><strong>Download</strong></td><td align="center"><strong>Last Modified</strong></td></tr><?php $row = mysql_fetch_assoc($result); ?><?php do { ?> <tr> <td align="center"> <input name="checkbox[]" type="checkbox" id="checkbox[]" value="<?php echo $row['id']; ?>"> </td> <td align="center"><?php echo $row['id']; ?></td> <td align="center"><?php echo $row['Name']; ?></td> <td align="center"><?php echo $row['Message']; ?></td> <td align="center"><a href="/admin/docs/<?php echo $row['Download']; ?>">Download</a></td> <td align="center"><?php echo $row['Modified']; ?></td> </tr> <tr> <td colspan="6" align="center"><input name="delete" type="submit" id="delete" value="Delete"></td> </tr></table></form></td></tr></table><?php } while($row = mysql_fetch_assoc($result)); ?> and these are the 2 lines the errors are referring to <?php $row = mysql_fetch_assoc($result); ?><?php do { ?><?php } while($row = mysql_fetch_assoc($result)); ?>
  12. thanks it is working now and i didn't have to change anything and both script you helped me with used the same database table and the first one was still working.
  13. it is not picking up the field name so it is just giving links like example.com/""
×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | 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.