Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
div not being created
Old 08-28-2010, 02:13 PM div not being created
Sleeping Troll's Avatar
Ultra Talker

Posts: 351
Name: Butch Begy
Trades: 0
In the following script, "text2" is not being created. Can anyone see why?

PHP Code:
<?php
$type
=$_REQUEST["Type"];
$term=$_REQUEST["Term"];
$count=$_REQUEST["Count"];
$menu=$_REQUEST["Menu"];
$ch curl_init(); 
$timeout 0// set to zero for no timeout 
curl_setopt ($chCURLOPT_URL"http://api.bing.net/json.aspx?AppId=y82488468y08yu896yt987y959cq&Market=en-US&Query=".$term."&Sources=".$type."&".$type.".Count=".$count."&JsonType=raw");
curl_setopt ($chCURLOPT_RETURNTRANSFER1); 
curl_setopt ($chCURLOPT_CONNECTTIMEOUT$timeout); 
$search curl_exec($ch); 
curl_close($ch);
$Response json_decode($search,true);
if (
$term == "Top")$term "Top News Stories";
$term str_replace("site:","",$term);  
$term explode("."$term);
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
     <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <meta http-equiv="X-UA-Compatible" content="IE=8" />
    <link href = "style.css" rel = "stylesheet" type = "text/css">
    <script type = 'text/javascript' src = '../scriptaculous/lib/prototype.js'></script>
    <script type = 'text/javascript' src = '../scriptaculous/src/scriptaculous.js'></script>
</head>
<body>
<div id = "container">
<div id = "text1" style = "top: '0px'">
<?php
foreach($Response['SearchResponse'][$type]['Results'] as $item)
{
    echo(
"
    <div onmouseover = \"clearInterval(Scroll)\" onmouseout = \"clearInterval(Scroll); Scroll = setInterval ('scroll()', 50)\">        
        <div class = 'Source'>
$term[0]</div>
        <div class = 'Title'><a href='
$item[Url]' target='_blank' style='color:yellow'><b>$item[Title]<b></a></div>
        <div class = 'Description' style='color:white'>
$item[Snippet]</div>
        <br>
    <div>
        "
);
}
?>
</div>
<div id = "text2" style = "top: '0px'">
<?php
foreach($Response['SearchResponse'][$type]['Results'] as $item)
{
    echo(
"
    <div onmouseover = \"clearInterval(Scroll)\" onmouseout = \"clearInterval(Scroll); Scroll = setInterval ('scroll()', 50);\">        
        <div class = 'Source'>
$term[0]</div>
        <div class='Title'><a href = '
$item[Url]' target='_blank' style='color:yellow'><b>$item[Title]<b></a></div>
        <div class='Description' style='color:white'>
$item[Snippet]</div>
        <br>
    <div>
        "
);
}    
?>
</div>
</div>
<?php
if(file_exists("../fills/$menu"))
{
    echo(
file_get_contents("../fills/$menu"));
}
?>
<script type = "text/javascript">
$("container").style.height = document.viewport.getHeight() + 'px';
$("container").style.width = document.viewport.getWidth() + 'px';
$('text1').style.top = 0 + 'px';
$('text2').style.top = $('text1').getHeight() + 'px';
resize();
window.onresize = resize;
var Scroll = setInterval ('scroll()', 50);

function scroll()
{
    if (parseInt($('text1').style.top) <= 0)
    {
                $('text2').style.top = parseInt($('text1').style.top) + $('text1').getHeight() + 'px';
    }
            if (parseInt($("text2").style.top) <= 0)
    {
                $('text1').style.top = parseInt($('text2').style.top) + $('text2').getHeight() + 'px';
    }
     $('text1').style.top = parseInt($('text1').style.top) - 1 +'px';    
    $('text2').style.top = parseInt($('text2').style.top) - 1 +'px';                    
}

function resize()
{
            $("container").style.top = 0 + 'px';
            $("container").style.left = 0 + 'px';
            $("container").style.height = document.viewport.getHeight() + 'px';
            $("container").style.width = document.viewport.getWidth() + 'px';
            $("text1").style.width = document.viewport.getWidth() + 'px';
            $("text2").style.width = document.viewport.getWidth() + 'px';
}
</script>
__________________
Sleeping Troll, EMUSE, Mind Expansion...Truly serendipity!
Sleeping Troll is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 08-28-2010, 02:36 PM Re: div not being created
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,384
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
probably the single quotes around the top value
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 08-28-2010, 03:12 PM Re: div not being created
Sleeping Troll's Avatar
Ultra Talker

Posts: 351
Name: Butch Begy
Trades: 0
Nope, have tried it all there "0px" '0px' 0px 0, css is very forgiving, they all work... but "text2" is not being created.
__________________
Sleeping Troll, EMUSE, Mind Expansion...Truly serendipity!
Sleeping Troll is offline
Reply With Quote
View Public Profile
 
Old 08-28-2010, 04:50 PM Re: div not being created
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,384
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Just exactly as it would be in HTML
HTML Code:
<div id="text1" style="top:0px;">
no extra spaces, no single quotes
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 08-28-2010, 05:00 PM Re: div not being created
Sleeping Troll's Avatar
Ultra Talker

Posts: 351
Name: Butch Begy
Trades: 0
No joy... $("text2") is null, Thing is Chris... "text1" is not a problem...
__________________
Sleeping Troll, EMUSE, Mind Expansion...Truly serendipity!

Last edited by Sleeping Troll; 08-28-2010 at 05:02 PM..
Sleeping Troll is offline
Reply With Quote
View Public Profile
 
Old 08-28-2010, 05:31 PM Re: div not being created
Sleeping Troll's Avatar
Ultra Talker

Posts: 351
Name: Butch Begy
Trades: 0
Found it! Thx for all your effort Chris, surprised you did not spot this one!

<div onmouseover = \"clearInterval(Scroll)\" onmouseout = \"clearInterval(Scroll); Scroll = setInterval ('scroll()', 50)\">
<div class = 'Source'>$term[0]</div>
<div class = 'Title'><a href='$item[Url]' target='_blank' style='color:yellow'><b>$item[Title]<b></a></div>
<div class = 'Description' style='color:white'>$item[Snippet]</div>
<br>
</div>

DOH! (slap!)
__________________
Sleeping Troll, EMUSE, Mind Expansion...Truly serendipity!
Sleeping Troll is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to div not being created
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.24427 seconds with 12 queries