Current location: Hot Scripts Forums » Programming Languages » PHP » a small problem and urgent


a small problem and urgent

Reply
  #11 (permalink)  
Old 08-25-06, 05:36 AM
mohit's Avatar
mohit mohit is offline
Newbie Coder
 
Join Date: Jul 2006
Location: India
Posts: 60
Thanks: 0
Thanked 0 Times in 0 Posts
this is my code..

PHP Code:

<?php

$stringData
='';
$stringval=0;
if (
$_GET['q']){
$stringData=$_GET['q'];
$stringval +=$_GET['offset'];
}
$stringData=trim($stringData);

function 
get_value_of($name)
{
     
$lines file('config.txt');

     foreach (
array_values($lines) AS $line)
     {
          list(
$key$val) = explode('='trim($line) );

          if (
trim($key) == $name)
          {
                return 
trim($val);
          }
     }
     return 
false;
}

$base_urlget_value_of('BaseUrl');


?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-type" content="text/html;charset=ISO-8859-1">
<link rel="stylesheet" type="text/css" href="/us_constitution/uscon.css">
<title>xyz:<?php echo $stringData?></title>
</head>

<body>

<div id="navigation">
<form id="usconSearch" action="">
<strong>
Search the <a href="<?php echo $base_url?>/index.html">US Constitution</a>:
</strong>
<input type="text" name="q" id="q" value="<?php echo $stringData?>">
<input type="submit" value="Search">
<input type="hidden" name="offset" value="0">
</form>
</div><!--navigation-->

<div id="bodytext">
<?php
$output 
'<?xml version="1.0" encoding="ISO-8859-1"?>';
$output .='<?xml-stylesheet type="text/css" href="my_css.css"?>';
$output .= shell_exec("search.pl $stringData $stringval");
//exec('search.exe "$stringData" "$stringval"',$output);
echo $output;
?>

<p style="font-size: smaller; color: #666">
<em>Powered by
<a href="/xyz/Index.html">
powered by xyz
</a>
</em>
</p>
</div><!--bodytext-->

</body>

</html>
lts check it..

Last edited by nico_swd; 08-25-06 at 05:39 AM.
Reply With Quote
  #12 (permalink)  
Old 08-25-06, 01:50 PM
UnrealEd's Avatar
UnrealEd UnrealEd is offline
Community Liaison
 
Join Date: May 2005
Location: Antwerp, Belgium
Posts: 3,165
Thanks: 4
Thanked 25 Times in 25 Posts
and what isn't working exactly? your code seems allright to me.

UnrealEd
__________________
"Good judgement comes from experience, and experience comes from bad judgement." - Fred Brooks

Reply With Quote
  #13 (permalink)  
Old 08-26-06, 01:03 AM
mohit's Avatar
mohit mohit is offline
Newbie Coder
 
Join Date: Jul 2006
Location: India
Posts: 60
Thanks: 0
Thanked 0 Times in 0 Posts
look at this..

$output .= shell_exec("search.pl $stringData $stringval");

if any variable has blank value then it create problem so i need to call this only when both variable have some value.....


and one more thing look at this latest part of code

PHP Code:

<?php

$output 
'<?xml version="1.0" encoding="ISO-8859-1"?>';
$output .='<?xml-stylesheet type="text/css" href="my_css.css"?>';
$output .= shell_exec("search.pl $stringData $stringval");
//exec('search.exe "$stringData" "$stringval"',$output);
//echo $output;
$dom=new DOMDocument();
$dom->LoadXML($output);
$root $dom->documentElement;
//echo $root->nodeName;
$report='';
if (
$root->hasChildNodes())
{
 
$children $root->childNodes;
     foreach(
$children as $node)
     {
          
          
//print $node->nodeName."\n";
          
if ($node->nodeName=="Result")
          {
               if (
$node->hasChildNodes())
               {
                    
$element=$dom->getElementsByTagName("Result");
                    
$report .= '<p>
                    <a href="$element->item(URL)->nodeValue"><strong>$element->item(Title)->nodeValue</strong></a>
                    <em>$element->item("Score")->nodeValue</em>
                    <br>
                    $element->item("BodyText")->nodeValue
                    <br>
                    <span class="excerptURL">$element->item("URL")->nodeValue</span></p>'
;
                    print 
$report;
                   
               }
               else
               {
                  
$report .='<p>"$node->nodeValue"</p>';  
               }
          }
          else
          {}
        
     }
}
?>

after getting the xml in return i will parse it in this way and then i will convert it in html paragraph so that also creating problem...
Thanks

Last edited by mohit; 08-26-06 at 01:12 AM.
Reply With Quote
  #14 (permalink)  
Old 08-28-06, 04:51 AM
UnrealEd's Avatar
UnrealEd UnrealEd is offline
Community Liaison
 
Join Date: May 2005
Location: Antwerp, Belgium
Posts: 3,165
Thanks: 4
Thanked 25 Times in 25 Posts
Quote:
Originally Posted by mohit
look at this..

$output .= shell_exec("search.pl $stringData $stringval");

if any variable has blank value then it create problem so i need to call this only when both variable have some value.....
the code nico_swd and i said will do:
PHP Code:

$stringData trim($stringData);

$stringval trim($stringval);
if(!empty(
$stringData) && !empty($stringval)){
// place your code here
}else{
  echo
"empty input";

what are the output problems you're having atm?
greetz,
UnrealEd
__________________
"Good judgement comes from experience, and experience comes from bad judgement." - Fred Brooks

Reply With Quote
  #15 (permalink)  
Old 08-29-06, 03:20 AM
mohit's Avatar
mohit mohit is offline
Newbie Coder
 
Join Date: Jul 2006
Location: India
Posts: 60
Thanks: 0
Thanked 0 Times in 0 Posts
Thanks to you all friends..

i have completed my task...your help worked and i could done it...

Thanks.

mohit
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
Problem working with createimagefromjpeg URGENT!! debasys PHP 2 06-03-06 12:45 AM
DTS speed problem! Naresh Rohra Visual Basic 1 03-01-06 08:47 AM
Urgent: Appending path for DLLs instread of using the real one chuck59 Visual Basic 0 10-29-05 02:19 AM
Small but urgent help needed GemiLinge PHP 3 10-04-05 08:15 AM
Urgent! Update fields problem Ogmios PHP 1 05-12-04 12:59 AM


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