rosdi Posted November 1, 2006 Share Posted November 1, 2006 Hi.I'm very new to php. Got script for scrolling text (not java) but using txt file to store data. I want to use mysql to store the data. Anybody can help?Original code files:1. colors.txt[code]background-color="#887788"font-color="#ffffff"font-size="13px"scrollamount="1"scrolldelay="40"width="150"height="150"[/code]2. news.txt[code]HNEWS="This is a news ticker"HLINK="http://www.a.com"HNEWS="free scripts and tutorial"HLINK="http://www.b.com"HNEWS="free web hosting "HLINK="http://www.c.com"HNEWS="online calculator and binary / hex / ascii convertors"HLINK="http://www.d.com"[/code]3. hnt.php[code]<?php $file1 = "./HNT/colors.txt";$lines1 = file($file1);//$count = count($lines1)foreach ($lines1 as $line_num1 => $line1){ $spos = strpos($line1,'ackground-color="'); if($spos != null && $spos > 0) { $spos2 = strpos($line1,'"',($spos+18)); //echo(".....".$spos."------".$spos2); $str = substr($line1,18,($spos2-($spos+17))); $bgcol = $str; //echo($bgcol); } $spos1 = strpos($line1,"ont-color="); if($spos1 != null && $spos1 > 0) { $spos2 = strpos($line1,'"',($spos1+12)); //echo(".....".$spos."------".$spos2); $str = substr($line1,12,($spos2-($spos1+11))); $fontcol = $str; $linkcol = $fontcol; //echo("||".$fontcol); } $spos1 = strpos($line1,"ink-color="); if($spos1 != null && $spos1 > 0) { $str = substr($line1,12,(strlen($line1)-15)); $linkcol = $str; echo("||".$linkcol); } $spos = strpos($line1,"crollamount="); if($spos != null && $spos > 0) { $spos2 = strpos($line1,'"',($spos+14)); //echo(".....".$spos."------".$spos2); $str = substr($line1,14,($spos2-($spos+13))); $scamount = $str; //echo("||".$scamount); } $spos = strpos($line1,"crolldelay="); if($spos != null && $spos > 0) { $spos2 = strpos($line1,'"',($spos+13)); //echo(".....".$spos."------".$spos2); $str = substr($line1,13,($spos2 - ($spos+12))); $scdelay = $str; //echo("||".$scdelay); } $spos = strpos($line1,"idth="); if($spos != null && $spos > 0) { $spos2 = strpos($line1,'"',($spos+7)); //echo(".....".$spos."------".$spos2); $str = substr($line1,7,($spos2-($spos+6))); $width = $str; //echo("||".$width); } $spos = strpos($line1,"eight="); if($spos != null && $spos > 0) { $spos2 = strpos($line1,'"',($spos+8)); //echo(".....".$spos."------".$spos2); $str = substr($line1,8,($spos2-($spos+7))); $height = $str; //echo("||".$height); } $spos = strpos($line1,"ont-size="); if($spos != null && $spos > 0) { $spos2 = strpos($line1,'"',($spos+11)); //echo(".....".$spos."------".$spos2); $str = substr($line1,11,($spos2-($spos+10))); $fsize = $str; //echo("||".$fsize); }}?><table width=<?php echo($width); ?> height=<?php echo($height); ?> ><tr><td><marquee height=<?php echo($height); ?> width=<?php echo($width); ?> bgcolor=<?php echo($bgcol); ?> scrollamount=<?php echo($scamount); ?> scrolldelay=<?php echo($scdelay); ?> direction=up onmouseover="this.stop()" onmouseout="this.start()"><br><?php $file1 = "./HNT/news.txt";$lines = file($file1);$count = count($lines);$newsf = false;$linkf = true;foreach ($lines as $line_num => $line){ if($newsf == false && $linkf == true) { $spos = strpos($line,"NEWS="); if($spos != null && $spos > 0) { $spos2 = strpos($line,'"',($spos+7)); $newsstr = substr($line,7,($spos2-($spos+6))); //echo("<div align=left style=\"color: ".$fontcol.";\" >".$newsstr."</div>"); $newsf = true; } } else if( $linkf == true && $newsf == true) { $spos = strpos($line,"LINK="); if($spos != null && $spos > 0) { $spos2 = strpos($line,'"',($spos+7)); $linkstr = substr($line,7,($spos2-($spos+6))); //echo("<div align=left><a href=".$linkstr." style=\"color: ".$linkcol."; \">".$linkstr."</a></div><br><br>"); echo("<div align=left style=\"margin: 10px;\"><a href=".$linkstr." style=\"color: ".$linkcol."; font-size: ".$fsize."; text-decoration: none; font-weight: bold;\">".$newsstr."</a></div><br>"); $newsf = false; $linkf = true; } else { $linkf = false; echo("<div style=\"color: red; font-weight: bold;\"> Improper Usage of NEWS TICKER </div>"); } }}?><br></marquee><div align=center style="background-color: <?php echo($bgcol); ?>; color: white; font-size: 10px;">tool by <a href=http://www.script.com style="color: white; font-decoration: none;">script.com</a></td></tr></table[/code] Link to comment https://forums.phpfreaks.com/topic/25781-scrolling-text-in-phpmysql/ Share on other sites More sharing options...
Twysted Posted November 12, 2006 Share Posted November 12, 2006 insert news into a database, and make a varible table in database telling it marquee then apply that to the news and bring it all out at one time. Link to comment https://forums.phpfreaks.com/topic/25781-scrolling-text-in-phpmysql/#findComment-123457 Share on other sites More sharing options...
rosdi Posted November 14, 2006 Author Share Posted November 14, 2006 The thing is that, I have no knowledge about PHP/mysql. Help me to construction. I'll pay you. Link to comment https://forums.phpfreaks.com/topic/25781-scrolling-text-in-phpmysql/#findComment-124343 Share on other sites More sharing options...
wildteen88 Posted November 14, 2006 Share Posted November 14, 2006 Whats the point in using PHP scripts if you don't know anything about PHP (and MySQL)!If you want someone to do this for you then post in the Freelance forum. Link to comment https://forums.phpfreaks.com/topic/25781-scrolling-text-in-phpmysql/#findComment-124584 Share on other sites More sharing options...
rosdi Posted November 14, 2006 Author Share Posted November 14, 2006 I'm not the expert like you. If don't want to help, just say. :'( Link to comment https://forums.phpfreaks.com/topic/25781-scrolling-text-in-phpmysql/#findComment-124600 Share on other sites More sharing options...
Twysted Posted November 16, 2006 Share Posted November 16, 2006 i will do it for ya, for $15 Link to comment https://forums.phpfreaks.com/topic/25781-scrolling-text-in-phpmysql/#findComment-125389 Share on other sites More sharing options...
rosdi Posted November 16, 2006 Author Share Posted November 16, 2006 [quote author=Twysted link=topic=113436.msg468788#msg468788 date=1163653223]i will do it for ya, for $15[/quote]Deal.Please convert both TXT files to table. My idea:1. I want to place it on my website frontpage: http://www.replica2u.com for latest news2. I also want to place this news at http://www.replica2u.com/store/news.php for new and old news3. In admin CP, I can select (using checkbox) which news I want to display in frontpage, edit and delete newsThanks. Link to comment https://forums.phpfreaks.com/topic/25781-scrolling-text-in-phpmysql/#findComment-125394 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.