Current location: Hot Scripts Forums » General Community » New Members & Introductions » Vertical Scrolling Text


Vertical Scrolling Text

Reply
  #1 (permalink)  
Old 11-15-05, 04:46 AM
ms_tyro ms_tyro is offline
New Member
 
Join Date: Nov 2005
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Vertical Scrolling Text

Hi, I am a newbie on website development and not a real webmaster or programmer. I need your help and expertise on this. Can anyone please link or give me a vertical scrolling text code? I wanted to put a news box in my website but I don't know how. I want my scrolling text to be stored in a certain text file, like notepad maybe, and not embedded on the html code, so I could just change it anytime I want without having to go to the website.
Reply With Quote
  #2 (permalink)  
Old 11-15-05, 09:14 AM
Nico's Avatar
Nico Nico is offline
Community Leader
 
Join Date: Sep 2005
Location: Spain
Posts: 8,075
Thanks: 11
Thanked 88 Times in 83 Posts
Hi, there! I did a custom script for you!
You will be able to edit the content from everywhere now.

Add this into the ducument where you want the scroller to put on.
(Must be a PHP document)

Add this before the <html> tag

PHP Code:

<?php


$action 
$_GET["action"];
$pass "admin";

// Admin form
if ($action == "admin"){
?>
Enter admin pass to continue: <br />
<form name="form1" id="form1" method="post" action="">
  <input name="admin_pass" type="password" id="admin_pass" />
  <input type="submit" name="Submit" value="Submit" />
</form>
<?php
}
?>


<?php
$admin_pass 
$_POST["admin_pass"];

// Fixes output
$content $_POST["content"];
$content str_replace("\\"""$content);

// Save changes
if ($_POST["content"]){
$fp fopen("content.php""w");
fwrite($fp$content);
fclose($fp);

echo 
"Content successfully changed";
}

// Displays the change form
if ($admin_pass == $pass){
?>

<form name="change" id="change" method="post" action="">
  <textarea name="content" cols="40" rows="6" id="content"><?php include ('content.php'); ?></textarea>
  <br />
  <input type="submit" name="Submit" value="Save changes" />
</form>
<?php
}if (empty($action)){
?>

Add this where you want the scroller to be displayed
Code:
<script type="text/javascript">

//specify path to your external page:
var iframesrc="external.php"

//You may change most attributes of iframe tag below, such as width and height:
document.write('<iframe id="datamain" src="'+iframesrc+'" width="150px" height="150px" marginwidth="0" marginheight="0" hspace="0" vspace="0" frameborder="1" scrolling="no"></iframe>')

</script>
And this at the bottom, after the </html> tag
PHP Code:

<?php

}
?>
Save this as "external.php" in the same directory
Code:
<html>
<body>

<div id="datacontainer" style="position:absolute;left:1px;top:10px;width:100%" onMouseover="scrollspeed=0" onMouseout="scrollspeed=cache">

<!-- SCROLER CONTENT //-->

<?php include ('content.php'); ?>

<!-- END SCROLLER CONTENT //-->

</div>

<script type="text/javascript">

/***********************************************
* IFRAME Scroller script- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/

//Specify speed of scroll. Larger=faster (ie: 5)
var scrollspeed=cache=2

//Specify intial delay before scroller starts scrolling (in miliseconds):
var initialdelay=500

function initializeScroller(){
dataobj=document.all? document.all.datacontainer : document.getElementById("datacontainer")
dataobj.style.top="5px"
setTimeout("getdataheight()", initialdelay)
}

function getdataheight(){
thelength=dataobj.offsetHeight
if (thelength==0)
setTimeout("getdataheight()",10)
else
scrollDiv()
}

function scrollDiv(){
dataobj.style.top=parseInt(dataobj.style.top)-scrollspeed+"px"
if (parseInt(dataobj.style.top)<thelength*(-1))
dataobj.style.top="5px"
setTimeout("scrollDiv()",40)
}

if (window.addEventListener)
window.addEventListener("load", initializeScroller, false)
else if (window.attachEvent)
window.attachEvent("onload", initializeScroller)
else
window.onload=initializeScroller

</script>
And finally save an empty file as "content.php" in the same directory as well and CHMOD it to "777".

Ok, now to edit the content go to the page where the scroller is, and add this at the end of the url:

?action=admin

Eg: http://www.your-site.com/index.php?action=admin

Than you'll see a form appears. The admin password is "admin"
(You can change the password on line 4, where the scroller is! )

Than edit the content and click on save!
That's it!

NOTE:
You can use HTML in the editor!

NOTE 2:
If you want to display the scroller on different pages, just add this code where you want it to be displayed.
(Make sure to fix the path if the document is in a different directory)

Code:
<script type="text/javascript">

//specify path to your external page:
var iframesrc="external.php"

//You may change most attributes of iframe tag below, such as width and height:
document.write('<iframe id="datamain" src="'+iframesrc+'" width="150px" height="150px" marginwidth="0" marginheight="0" hspace="0" vspace="0" frameborder="1" scrolling="no"></iframe>')

</script>
(You won't be able the change the content from other pages tho!)

Scroller demo here: http://www.nicoswd.com/scroller/scroller.php

Admin demo here: http://www.nicoswd.com/scroller/scro...p?action=admin
(PW: "admin")

Script download here: http://www.nicoswd.com/scroller/vertical_scroller.zip

Have fun!
Reply With Quote
  #3 (permalink)  
Old 11-15-05, 10:20 PM
ms_tyro ms_tyro is offline
New Member
 
Join Date: Nov 2005
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
thanks much nico...your help is really appreciated.

i will try the codes tonight and will let you know if ever i encounter some problems

thanks again!!!
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Vertical only scrolling. liljoeyjordison CSS 5 11-16-10 05:50 AM
Vertical Text Alignment!!!!!!!! leestratton CSS 2 06-03-05 12:06 AM
Problem seting Vertical Text - to Print drmoobi CSS 0 07-29-04 11:05 AM
MySQL Query problem Wraith PHP 5 03-06-04 05:16 PM
picking random entries with a filter... Double selection problem dsumpter PHP 7 11-16-03 07:19 PM


All times are GMT -5. The time now is 02:46 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.