PhpDig.net

Go Back   PhpDig.net > PhpDig Forums > How-to Forum

Reply
 
Thread Tools
Old 12-01-2004, 05:38 AM   #1
1001studio
Green Mole
 
Join Date: Jun 2004
Location: Italy
Posts: 6
Question Php code in results

Hello,

I'd like to have some infos regarding how include a php code string in result page.
Actually, as obvious, php has not parsed.
I setup an header in .php and it works (I follow the forum instructions to do it) but I cannot insert a php string before all results of my search.

Any idea or thread you know to setup the script?


Thank you
Jacopo
1001studio is offline   Reply With Quote
Old 12-01-2004, 05:36 PM   #2
vinyl-junkie
Purple Mole
 
Join Date: Jan 2004
Posts: 694
Did you look at the documentation where it mentions the different entities that are available for the search results page?

If that isn't the type of thing you're looking for, please give us an example of the type of output you're seeking.
vinyl-junkie is offline   Reply With Quote
Old 12-02-2004, 02:52 AM   #3
1001studio
Green Mole
 
Join Date: Jun 2004
Location: Italy
Posts: 6
Thank you for reply. I looked at that but I need a custom entity.
I need this:
When people search at this page:

http://www.grandepadre.com/spider/
i.e. the keyword internet

in the result page I include this string

<script src="http://www.massmediem.com/smartsearch/include.cgi?keywords=<? echo $query_string; ?>&java=1"></script>

that return me also other results for the keyword.
But the php code hasn't parsed and return exactly as I wrote in the code.
How could I setup the code for parse php in this contest?

Thank you for any ideas.
Jacopo
1001studio is offline   Reply With Quote
Old 12-02-2004, 10:59 AM   #4
leonardburton
Green Mole
 
Join Date: Dec 2004
Posts: 10
a simple solution I implemented

I would assume the code in your header will allow you to call the script tag. with that being the case this will put the results at the bottom of the results page. Its a start.

Use the include file so it will be easy to move arond the code later.


Here is what i did that got something working around line 765 in libs/search_function.php I added an include line:

}
$timer->stop('Template parsing');
$timer->stop('All display');
$timer->stop('All');
//$timer->display();


//I included this line here and it is around line 765 but the other code in this snippet comes directly from the file.
include "lexicon.inc";

}

function by_length($a, $b) {
$len_a = strlen($a);
$len_b = strlen($b);
if ($len_a == $len_b) { return 0; }
return ($len_a < $len_b) ? 1 : -1;
}


in lexicon.inc do this:

<?php;
<script src="http://www.massmediem.com/smartsearch/include.cgi?keywords=<? echo $query_string; ?>&java=1"></script>
?>
leonardburton is offline   Reply With Quote
Old 12-03-2004, 05:49 AM   #5
1001studio
Green Mole
 
Join Date: Jun 2004
Location: Italy
Posts: 6
Hi,

that's good but there's still the problem that lexicon code is on the top of the page or at the bottom of the page.
I need it before results.

Jacopo
1001studio is offline   Reply With Quote
Old 12-03-2004, 05:51 AM   #6
Charter
Head Mole
 
Charter's Avatar
 
Join Date: May 2003
Posts: 2,539
http://www.phpdig.net/forum/showthread.php?t=348
__________________
Responses are offered on a voluntary if/as time is available basis, no guarantees. Double posting or bumping threads will not get your question answered any faster. No support via PM or email, responses not guaranteed. Thank you for your comprehension.
Charter is offline   Reply With Quote
Old 12-03-2004, 07:31 AM   #7
1001studio
Green Mole
 
Join Date: Jun 2004
Location: Italy
Posts: 6
Still no way to parse that code but I've found something interesting IMHO.
Putting header and footer they always goes at the top of the page.
So I create a new .php header with more code including all before form search mask.
It still gave me problems at the top of the code. To avoid this change this:

<?xml version="1.0" encoding="ISO-8859-1"?>

with this:

<?php
echo "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>";
?>

But still other issues in the code.

1) Now it appear the number "1" in the middle of the page. Nobody knowns what is that?

2) Still have problem to include code beetween form mask and search results.

Jacopo
1001studio is offline   Reply With Quote
Old 12-03-2004, 09:42 PM   #8
Charter
Head Mole
 
Charter's Avatar
 
Join Date: May 2003
Posts: 2,539
From php.net:

return.php
PHP Code:
<?php

$var 
'PHP';

return 
$var;

?>
noreturn.php
PHP Code:
<?php

$var 
'PHP';

?>
testreturns.php
PHP Code:
<?php

$foo 
= include 'return.php';

echo 
$foo// prints 'PHP'

$bar = include 'noreturn.php';

echo 
$bar// prints 1

?>
So if you structure the included files using return then you should be able to do as in this thread without order problems.
__________________
Responses are offered on a voluntary if/as time is available basis, no guarantees. Double posting or bumping threads will not get your question answered any faster. No support via PM or email, responses not guaranteed. Thank you for your comprehension.
Charter is offline   Reply With Quote
Reply

Thread Tools

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
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I integrate results pages into a php site? RubiconCSL How-to Forum 0 05-30-2006 04:52 AM
show results in an include (php) vuurvos How-to Forum 1 10-05-2005 06:44 AM
Affiliate code JPSSAU How-to Forum 1 06-19-2004 05:51 AM
Code Requests Charter Feedback & News 0 02-28-2004 11:45 PM
Documented code alivin70 Mod Submissions 1 10-06-2003 02:34 PM


All times are GMT -8. The time now is 05:12 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
Copyright © 2001 - 2005, ThinkDing LLC. All Rights Reserved.