PhpDig.net

PhpDig.net (http://www.phpdig.net/forum/index.php)
-   How-to Forum (http://www.phpdig.net/forum/forumdisplay.php?f=33)
-   -   Php code in results (http://www.phpdig.net/forum/showthread.php?t=1561)

1001studio 12-01-2004 05:38 AM

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

vinyl-junkie 12-01-2004 05:36 PM

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.

1001studio 12-02-2004 02:52 AM

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

leonardburton 12-02-2004 10:59 AM

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>
?>

1001studio 12-03-2004 05:49 AM

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

Charter 12-03-2004 05:51 AM

http://www.phpdig.net/forum/showthread.php?t=348

1001studio 12-03-2004 07:31 AM

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

Charter 12-03-2004 09:42 PM

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.


All times are GMT -8. The time now is 02:46 AM.

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