String Builder

php-writer | PHP Articles | Thursday, 17 July 2008
Package:
Summary:
Concatenate strings in several ways
Groups:
Author:
Description:
This class can be used to concatenate strings.

It can concatenate strings in several ways:

- Append a string to another
- Append a string with a line break either in plain text or HTML
- Concatenate a variable number of string with a given concatenation format




Read more about “String Builder” or more “PHP Articles”

USB connecting problem

php-writer | PHP Articles | Thursday, 17 July 2008
Guys ‘n’ Gals,

A month or so ago I tried to plug my Kingston USB pen into my PC (XP SP2) to download some photos. The Usb pen said it was being charged but the PC seems to have no inkling that it’s connected. I can’t force it to pick it up when it can’t see anything there at all. I’ve not been able to connect it to the PC since.

Can anyone suggest what might (not) be happening?

Thanks,all

chris

Read more about “USB connecting problem” or more “PHP Articles”

Inserting videos in flash

php-writer | PHP Articles | Thursday, 17 July 2008
can anyone pls help me in flash how we embeeded videos , I was really amazed after visiting this website http://www.logodesignguru.com

gr8 work ,,,, pls help me on this

Read more about “Inserting videos in flash” or more “PHP Articles”

another fading way for ProHTML Ticker

php-writer | PHP Articles | Thursday, 17 July 2008
1) Script Title: PrpHTML Ticker

2) Script URL (on DD): http://www.dynamicdrive.com/dynamici…htmlticker.htm

3) Describe problem:

I am testing another way applying fading effect for ProHTML Ticker based on Image Fader (http://home.comcast.net/~jscheuer1/s…eset_write.htm). Here is the code I came up with:

Code:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>HTML Ticker</title>
<style type="text/css">

#tickersubject{
width: 250px;
font-weight: bold;
}

.tickercontainer{
width: 250px;
height: 200px;
border: 1px solid black;
background-color: #DFDFFF;
padding: 3px;
display:block;
}

</style>

<script type="text/javascript">

/***********************************************
* ProHTML Ticker script- © Dynamic Drive (www.dynamicdrive.com)
* This notice must stay intact for use
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/

var tickspeed=2000 //ticker speed in miliseconds (2000=2 seconds)
var enablesubject=1 //enable scroller subject? Set to 0 to hide

if (document.getElementById){
document.write(’<style type="text/css">\n’)
document.write(’.tickercontainer{display:none;}\n’)
document.write(’</style>\n’)
}

var selectedDiv=0
var totalDivs=0

/* Cross Browser Image Fader © 2007 John Davenport Scheuer
  This comment must remain for Legal Use  */

var faders=[];
// Preset each image’s initial opacity (0 to 100):
// ex:  faders[x]=['image_id', initial_opacity];

////////////// Stop Editing //////////////

function fade(el, way, op, opinc, speed){
        if(!fade.prprt&&!fade.ie)
                return;
        var id=typeof el==’string’? el : el.id, el=typeof el==’object’? el : document.getElementById(el);
        clearTimeout(fade[id+'timer']);
        var op_obj=fade.ie6? el.filters[0] : el.style,
        waym=way==’in’? 1 : -1, speed=speed? speed*1 : 30, opinc=opinc&&opinc>=1? opinc*(fade.ie? 1 : .01) : opinc? opinc : fade.ie? 5 : .05,
        op=op&&fade.ie? op*1 : op&&op*1>=1? Math.min(op*.01, .99) : op? op : waym>0&&fade.ie? 100 : waym>0? .99 : 0;
        if(!fade.ie6&&!fade[id+'yet']){
                if(fade.prprt)
                        op_obj[fade.prprt]=Math.min(fade.preset(id)*.01, .99);
                else if(fade.ie)
                        op_obj.filter=’alpha(opacity=’+fade.preset(id)+’)';
                fade[id+'yet']=true;
        }
        if(fade.prprt&&Math.abs(op*1-op_obj[fade.prprt]*1)<opinc)
                op_obj[fade.prprt]=op;
        else if(fade.prprt)
                op_obj[fade.prprt]=fade.ie6? op_obj[fade.prprt]*1 + opinc*waym : Math.min(op_obj[fade.prprt]*1 + opinc*waym, .99);
        else if (fade.ie&&Math.abs(op*1 - op_obj.filter.replace(/\D/g,”)*1)<opinc)
                op_obj.filter=’alpha(opacity=’+op+’)';
        else if (fade.ie)
                op_obj.filter=’alpha(opacity=’+[op_obj.filter.replace(/\D/g,'')*1 + opinc*waym]+’)';
        else
                return;
        if(op_obj[fade.prprt]&&op_obj[fade.prprt]*waym<op*waym||!fade.ie6&&fade.ie&&op_obj.filter.replace(/\D/g,”)*waym<op*waym)
                fade[id+'timer']=setTimeout(function(){fade(el, way, op, opinc, speed)}, speed);
}

if(document.documentElement&&document.documentElement.style){
        fade.d=document.documentElement, fade.t=function(o){return typeof fade.d.style[o]==’string’}; if(fade.d.filters)
        document.write(’<span id="ie_test" style="filter:progid:DXImageTransform.Microsoft.alpha(opacity=0);position:absolute;top:-1000px;">p<\/span>’);
        fade.ie=fade.d.filters&&ie_test.filters[0], fade.ie6=fade.ie&&typeof ie_test.filters[0].opacity==’number’,
        fade.prprt=fade.t(’opacity’)||fade.ie6? ‘opacity’ : fade.t(’MozOpacity’)? ‘MozOpacity’ : fade.t(’KhtmlOpacity’)? ‘KhtmlOpacity’ : null;
}

fade.set=function(){
        var prop=fade.prprt==’opacity’? ‘opacity’ : fade.prprt==’MozOpacity’? ‘-moz-opacity’ : ‘-khtml-opacity’;
        document.write(’\n<style type="text/css">\n’)
        for (var i = 0; i < faders.length; i++)
                document.write(’#'+faders[i][0]+’ {\n’+(fade.ie? ‘filter:progid:DXImageTransform.Microsoft.alpha(opacity=’+faders[i][1]+’)’ : prop+’:'+Math.min(faders[i][1]*.01, .99))+’;\n}\n’);
        document.write(’<\/style>\n’)
}

fade.preset=function(id){
        for (var i = 0; i < faders.length; i++)
                if (id==faders[i][0])
                        return faders[i][1];
                return 0;
}

function contractall(){
var inc=0
while (document.getElementById("message"+inc)){
document.getElementById("message"+inc).style.display="none"
inc++
}
}

function expandone(){
var selectedDivObj=document.getElementById("message"+selectedDiv)
contractall()
document.getElementById("tickersubject").innerHTML=selectedDivObj.getAttribute("subject")
selectedDivObj.style.display="block"
fade("message"+selectedDiv,’in’,100);
selectedDiv=(selectedDiv<totalDivs-1)? selectedDiv+1 : 0
setTimeout("expandone()",tickspeed)
}

function startscroller(){
while (document.getElementById("message"+totalDivs)!=null)
totalDivs++
expandone()
if (!enablesubject)
document.getElementById("tickersubject").style.display="none"
}

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

</script>
</head>
<body>
<div id="tickersubject"></div>

<div id="message0" class="tickercontainer" subject="What is JavaScript?">
JavaScript is a scripting language originally developed by Netscape to add interactivity and power to web documents. It is purely client side, and runs completely on the client’s browser and computer.
</div>

<div id="message1" class="tickercontainer" subject="Java & JavaScript Differences">
Java is completely different from JavaScript- it’s more powerful, more complex, and unfortunately, a lot harder to master. It belongs in the same league as C, C++, and other more complex languages. Java programs need to be compiled before they can run, while JavaScript do not.
</div>

<div id="message2" class="tickercontainer" subject="What is DHTML?">
DHTML is the embodiment of a combination of technologies- JavaScript, CSS, and HTML. Through them a new level of interactivity is possible for the end user experience.
</div>
</body>
</html>


The problem is every element fades the first time only, and after that they do not fade at all. Why is that? Everybody helps please!

Thanks,

D.

Read more about “another fading way for ProHTML Ticker” or more “PHP Articles”

Logo Design

php-writer | PHP Articles | Thursday, 17 July 2008
With the omission of design art, British graphic design has enjoyed modest credit on the international stage – until now. This remarkable new story tells a very remarkable scene about the development of design in the United Kingdom, and it does so with typical Britain flair. , Britain graphic design has thrived on a massive amount of exterior influences from places as far a field as Russia, Switzerland, Poland, Germany and Hungary. The designers here are famous artists; actually, some of the world’s most revered.

http://www.logodesignpros.co.uk/

Read more about “Logo Design” or more “PHP Articles”

ZF Well Represented at SourceForge Awards - Andi on Web & IT

php-writer | PHP Articles | Thursday, 17 July 2008

SourceForge will be presenting its community choice awards at OSCON again this year. The Zend Framework team will be watching closely, since no fewer than two (!) new ZF-based projects have made it in to the finals: Magento and Tine 2.0.

Magento has been taking the eCommerce software world by storm. We’ve been hearing a lot about Magento as a well-designed and well-executed software product, but you’ve got to hand it to the Magento team for awesome community-focused resources like Magento Connect. I can only assume they built this stuff with all the development time ZF saved them. ;) Magento is a finalist in the following categories: Best Project for the Enterprise, Best New Project, Most Likely to Change the World & Most Likely to Be the Next B Acquisition. Make sure you put in your vote here. Congrats, guys!

Tine 2.0 is another big enterprise-oriented project, but focused on the intranet and collaboration. It’s also a full rewrite of the popular eGroupWare project using Zend Framework to improve maintainability and stability, among other things. Tine 2.0 is a finalist in the Best New Project category. Way to go!

One of our goals in building ZF was to provide a solid foundation upon which other project teams could build great software. I think Magento and Tine 2.0 are proof that we’ve had some impact here. It’s particularly nice to see the warm reception of ZF as a foundation for PHP best practices in the OS community. Who knows? Maybe next year you’ll be able to vote for ZF itself.

Good luck to both projects!

[Thanks to Wil Sinclair for contributing content for this post]

Read more about “ZF Well Represented at SourceForge Awards - Andi on Web & IT” or more “PHP Articles”

Step Carousel Viewer - Jump to specific slide

php-writer | PHP Articles | Wednesday, 16 July 2008
1) Script Title:
Step Carousel Viewer

2) Script URL (on DD):
http://www.dynamicdrive.com/dynamici…epcarousel.htm

3) Describe problem:
I am trying to build a website based on the Step Carousel Viewer. One way of navigating is by clicking onto "Back" and "Next", which works fine. However I would like to be able to jump to a specific slide i.e. "Biography" no matter of the position of the slide show at that time.

Try:
1. Click onto "Next", it will take you to the second slide - fine
2. Click onto "Biography", the slide show jumps back to the first slide, instead of the third (as defined in the button command)! Why?

Strangely, when clicking onto "Biography" without using "Next" or "Back" links the jump to the "Biography" slide works fine.

Also, when clicking twice onto "Biography" the slideshow keeps bouncing back and forth between the first & third slide, whereas it should simply stop on the third slide.

4. Testing Site Domain
http://bentographics.com/test/MarianneBailey/

How can this be fixed?
I will donate 30$ to your Paypal if you help me out on this.

Many thanks for your help!

Read more about “Step Carousel Viewer - Jump to specific slide” or more “PHP Articles”

Another Day At The Office…

php-writer | PHP Articles | Wednesday, 16 July 2008
In my line of work, this truly is just another day at the office…

Read more about “Another Day At The Office…” or more “PHP Articles”

Pausing up-down Scroller - any direction

php-writer | PHP Articles | Wednesday, 16 July 2008
1) Script Title: Pausing up-down Scroller

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex2/crosstick.htm

3) Describe problem:

I want to control the direction that the scoller will scroll to, so I modify it a little. For now, the code below works with left, right, top, bottom:

Code:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>pausing up-down Scroller</title>
<style type="text/css">

/*Example CSS for the two demo scrollers*/

#pscroller1{
width: 200px;
height: 100px;
border: 1px solid black;
padding: 5px;
background-color: lightyellow;
}

#pscroller2{
width: 350px;
height: 100px;
border: 1px solid black;
padding: 3px;
}

#pscroller2 a{
text-decoration: none;
}

.someclass{ //class to apply to your scroller(s) if desired
}

</style>

<script type="text/javascript">

/*Example message arrays for the two demo scrollers*/

var pausecontent=new Array()
pausecontent[0]=’<a href="http://www.javascriptkit.com">JavaScript Kit</a><br />Comprehensive JavaScript tutorials and over 400+ free scripts!’
pausecontent[1]=’<a href="http://www.codingforums.com">Coding Forums</a><br />Web coding and development forums.’
pausecontent[2]=’<a href="http://www.cssdrive.com" target="_new">CSS Drive</a><br />Categorized CSS gallery and examples.’

var pausecontent2=new Array()
pausecontent2[0]=’<a href="http://www.news.com">News.com: Technology and business reports</a>’
pausecontent2[1]=’<a href="http://www.cnn.com">CNN: Headline and breaking news 24/7</a>’
pausecontent2[2]=’<a href="http://news.bbc.co.uk">BBC News: UK and international news</a>’

</script>

<script type="text/javascript">

/***********************************************
* Pausing up-down scroller- © Dynamic Drive (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for this script and 100s more.
***********************************************/

function pausescroller(content, divId, divClass, delay, scrollto){
this.scroll=scrollto // direction from
this.content=content //message array content
this.tickerid=divId //ID of ticker div to display information
this.delay=delay //Delay between msg change, in miliseconds.
this.mouseoverBol=0 //Boolean to indicate whether mouse is currently over scroller (and pause it if it is)
this.hiddendivpointer=1 //index of message array for hidden div
document.write(’<div id="’+divId+’" class="’+divClass+’" style="position: relative; overflow: hidden"><div class="innerDiv" style="position: absolute; width: 100%" id="’+divId+’1">’+content[0]+’</div><div class="innerDiv" style="position: absolute; width: 100%; visibility: hidden" id="’+divId+’2">’+content[1]+’</div></div>’)
var scrollerinstance=this
if (window.addEventListener) //run onload in DOM2 browsers
window.addEventListener("load", function(){scrollerinstance.initialize()}, false)
else if (window.attachEvent) //run onload in IE5.5+
window.attachEvent("onload", function(){scrollerinstance.initialize()})
else if (document.getElementById) //if legacy DOM browsers, just start scroller after 0.5 sec
setTimeout(function(){scrollerinstance.initialize()}, 500)
}

// ——————————————————————-
// initialize()- Initialize scroller method.
// -Get div objects, set initial positions, start up down animation
// ——————————————————————-

pausescroller.prototype.initialize=function(){
this.tickerdiv=document.getElementById(this.tickerid)
this.visiblediv=document.getElementById(this.tickerid+"1")
this.hiddendiv=document.getElementById(this.tickerid+"2")
this.visibledivtop=parseInt(pausescroller.getCSSpadding(this.tickerdiv))
//set width of inner DIVs to outer DIV’s width minus padding (padding assumed to be top padding x 2)
this.visiblediv.style.width=this.hiddendiv.style.width=this.tickerdiv.offsetWidth-(this.visibledivtop*2)+"px"
this.getinline(this.visiblediv, this.hiddendiv)
this.hiddendiv.style.visibility="visible"
var scrollerinstance=this
document.getElementById(this.tickerid).onmouseover=function(){scrollerinstance.mouseoverBol=1}
document.getElementById(this.tickerid).onmouseout=function(){scrollerinstance.mouseoverBol=0}
if (window.attachEvent) //Clean up loose references in IE
window.attachEvent("onunload", function(){scrollerinstance.tickerdiv.onmouseover=scrollerinstance.tickerdiv.onmouseout=null})
setTimeout(function(){scrollerinstance.animate()}, this.delay)
}

// ——————————————————————-
// animate()- Move the two inner divs of the scroller up and in sync
// ——————————————————————-

pausescroller.prototype.animate=function(){
var scrollerinstance=this
if (parseInt(this.hiddendiv.style[this.scroll])>(this.visibledivtop+5)){
this.visiblediv.style[this.scroll]=parseInt(this.visiblediv.style[this.scroll])-5+"px"
this.hiddendiv.style[this.scroll]=parseInt(this.hiddendiv.style[this.scroll])-5+"px"
setTimeout(function(){scrollerinstance.animate()}, 50)
}
else{
this.getinline(this.hiddendiv, this.visiblediv)
this.swapdivs()
setTimeout(function(){scrollerinstance.setmessage()}, this.delay)
}
}

// ——————————————————————-
// swapdivs()- Swap between which is the visible and which is the hidden div
// ——————————————————————-

pausescroller.prototype.swapdivs=function(){
var tempcontainer=this.visiblediv
this.visiblediv=this.hiddendiv
this.hiddendiv=tempcontainer
}

pausescroller.prototype.getinline=function(div1, div2){
div1.style[this.scroll]=this.visibledivtop+"px"
if (this.scroll==(’top’|'bottom’)) {
        div2.style[this.scroll]=Math.max(div1.parentNode.offsetHeight, div1.offsetHeight)+"px"
} else {
        div2.style[this.scroll]=Math.max(div1.parentNode.offsetWidth, div1.offsetWidth)+"px"
}
}

// ——————————————————————-
// setmessage()- Populate the hidden div with the next message before it’s visible
// ——————————————————————-

pausescroller.prototype.setmessage=function(){
var scrollerinstance=this
if (this.mouseoverBol==1) //if mouse is currently over scoller, do nothing (pause it)
setTimeout(function(){scrollerinstance.setmessage()}, 100)
else{
var i=this.hiddendivpointer
var ceiling=this.content.length
this.hiddendivpointer=(i+1>ceiling-1)? 0 : i+1
this.hiddendiv.innerHTML=this.content[this.hiddendivpointer]
this.animate()
}
}

pausescroller.getCSSpadding=function(obj){ //get CSS padding value, if any
if (obj.currentStyle)
return obj.currentStyle["paddingTop"]
else if (window.getComputedStyle) //if DOM2
return window.getComputedStyle(obj, "").getPropertyValue("padding-top")
else
return 0
}

new pausescroller(pausecontent, "pscroller1", "someclass", 3000, ‘left’)

</script>
</head>
<body>

</body>
</html>


Nothing wrong with left, right, top at all, except bottom. When scroller is set with bottom, the text is aligned with the bottom of the div - that I do not want. I want the text is aligned with the top, when the scroller still scrolls to bottom.

I tried to modify almost everything related to top, bottom but with no success. Anybody has advice?

Another question: is it possible to modify the code so that it scrolls diagonally, say for example, from top-left?

Thanks,

D.

Read more about “Pausing up-down Scroller - any direction” or more “PHP Articles”

IE6 innerHTML + img problem.

php-writer | PHP Articles | Wednesday, 16 July 2008
Please see this page, specifically the lower-right box:

http://racewayford.autofusion.com/

When you click one of the headings, the images change to match. Minus some needed css tweaking, this box works just fine in Firefox and IE7. In IE6, however, the pictures show up, BUT ARE INVISIBLE!! :o

Seriously. On my coworker’s machine there are little image icons, but on my machine there are invisible boxes that have the dimensions of the image. If you right click and select "show image," the image magically appears! These images are wrapped in anchors and the anchors function normally, just the images don’t show up.

I tried using a simple function to preload the images, but unfortunately that didn’t change the outcome. But it seems to be a cache issue, because after you click "show image," it will load happily after that if the page is refreshed.

Thanks for any input.

Read more about “IE6 innerHTML + img problem.” or more “PHP Articles”

Designed by
Powered By Wordpress - Theme Provided By Wordpress Themes - Wordpress