PDA

View Full Version : change PHPDig to get a GET instead of a POST...


noel
11-03-2005, 01:16 PM
Hi CHARTER,

Here is my problem I use a tool that displays AD , depend of the key word put in the search field, it is the same as the adwords of google .

You will find under what this tools program ask for me :what:

****************
Because you have chosen to use keywords in this zone. No ads will display, unless you have added keywords to each ad in this zone, and have added keyword to the ad code. You must be capable of adding keywords to the ad code(s) shown below to get this to work. If you are using a search engine, you must be able to modify your search engine code, to automatically add keywords to the ad code.
The following ad code fragment needs to be modified as follows, if for example, you want to show ads containing the keyword microsoft word:

...index.php?section=serve&zone=2&keyword=micrsoft%20word&output=js...
Note that you must encode compound keyword. For example, the phrase microsoft word should be "encoded" any of the possible ways: microsoft+word or even microsoft%20word.

**********************

I send to the distributor the gaagle.html template, and ask him if he could do the change, he said yes but he had this problem, this answer :

"I looked at the template, and I cannot see where to get the keyword
typed in (this is important).

If we can change PHPDig to get a GET instead of a POST that would
probably fix he problem, but I can't change the form submission type in
here."


Where do you think the informations he need are ?
What do you think he had to change, and what it is better not to change ?
What are the files I had to send him to change ?

Thank you very much,

Noël

Charter
11-05-2005, 01:02 PM
In function_phpdig_form.php there are three spots to...

Change from:

action='$result_page' method='post'

To something like:

action='$result_page?query_string='".urlencode(stripslashes($query_string))." method='post'

noel
11-05-2005, 05:15 PM
Hi CHARTER,

I changed code, search still work :) but is it normal that now searchs takes more time (x2) ?

Thank You

Noël

noel
11-06-2005, 07:08 AM
Hi CHARTER,
Well I changed GET instead of a POST , it seems ok, but the problem that I have it is that I need in the URL of the Internet Explorer (or other) appears the words of the research , now I have :

http://www.mysite.com/gaagle/search.php?query_string=

But as you can see there aren't the words that I wrote in the search field.

I need that :

http://www.mysite.com/gaagle/search.php?query_string=hotel

For example I wrote hotel in the search engine.

Like that the script of my tool can compare these words with the words it had in his base.

Thank You

Noël

Charter
11-06-2005, 12:49 PM
Maybe your ad program takes time to find and display the ads based on query string, so that might account for the extra time. If you are going to use GET instead of POST, use the following instead:

action='$result_page' method='get'

However, if you want to use POST so that only query string shows in the address bar, the following will be one search behind without some sort of redirect.

action='$result_page?query_string='".urlencode(stripslashes($query_string))." method='post'

To remedy the one search behind issue with POST, use the following:

action='$result_page' method='post'

And in your template add:

<script language="javascript">
<!--
function actionModifier() {
var qstring = document.forms[0].elements[4].value;
qstring = qstring.replace(" ","+");
document.forms[0].action += "?query_string=" + escape(qstring);
}
// -->
</script>

After the following:

<phpdig:js_for_clicks/>

And in function_phpdig_form.php find:

$result['form_button'] = "<input type='submit' class='phpdiginputsubmit' name='search' value='".phpdigMsg('go')."'/>";

And replace with:

$result['form_button'] = "<input type='submit' class='phpdiginputsubmit' name='search' onclick='javascript: actionModifier();' value='".phpdigMsg('go')."'/>";

noel
11-08-2005, 01:45 PM
Hi CHARTER,

I tried your code, non errors, but my adwords still doesn't work ;(

The developper said :
If you are using a search engine, you must be able to modify your search engine code, to automatically add keywords to the ad code.
The following ad code fragment needs to be modified as follows, if for example, you want to show ads containing the keyword microsoft word:

...index.php?section=serve&zone=2&keyword=micrsoft%20word&output=js...


The entire script line that we have to put in the page where we want that ads appears is :

<script src="http://www.mysiteindex.php?section=serve&id=40&keyword=*********&output=js"></script>

Where I put ******** it is where a script in the search engine has to put keywords that people put in the search field , and I don't know how to do this script and where I have to put it, in phpdig ??

Thank You

Noël

noel
11-08-2005, 02:09 PM
Is this information can help you :

If you are using a search engine and you want to enable the dynamic keyword
search feature:


Follow the few easy steps:
1. Make (or edit) a zone and check the "Enable Keyword Box" OK I DID
2. Make some rates for the zone OK I DID
3. Make an ad for the zone and add some keywords to it as instructed OK I DID
4. Edit the javascript ad code for the zone in #1 as follows: NOT OK I DON'T KNOW :)


You need to replace KEYWORDS with the actual keywords that the user
searched for in your search engine HTML code where you will put the ad
code. You can replace the KEYWORDS with the actual search query variable
that appears in the web address bar when you do a search, for example when
you do a search on google for games, you will see in address bar 'q=games'.
In that case q is the search query variable.

Charter
11-10-2005, 09:15 PM
In function_phpdig_form.php find:

$query_string2 = urlencode(stripslashes($query_string));

And afterwards add:

$result['keyword_ads'] = "<script src=\"http://www.CHANGEME.com/index.php?section=serve&id=40&keyword=".$query_string2."&output=js\"></script>";

Now in the template use:

<phpdig:keyword_ads/>

Wherever you want the ads to appear.

noel
11-11-2005, 07:45 AM
Hi CHARTER you are a CHAMPION ;)

It works , there is just a small problem, when I put 2 words in the search field there is just the first that is take in consideration, it is said in the software :

"Note that you must encode compound keyword. For example, the phrase microsoft word should be "encoded" any of the possible ways: microsoft+word or even microsoft%20word "

Is it possible ?

Thank You

Noël

Charter
11-11-2005, 08:58 AM
Note that $result['keyword_ads'] uses $query_string2 and $query_string2 is already urlencoded. ;)

noel
11-11-2005, 02:06 PM
Working very well now, I had to make a little config of my adwords software.

THANK'S A LOT ;-)

Noel