The "what" parameter is a very powerful method of selecting the right banner you want to display, but if you want to keep it simple the 'what' parameter can also be very easy to use.
Selecting a banner by keyword
If you want to display a banner with a specific keyword you can simply specify that keyword as the 'what' parameter.
Display a banner with the keyword 'main'
Display a banner with the keyword 'key1'
It is also possible to specify multiple keywords as the 'what' parameter, separated by a comma (,). phpAdsNew will try to display a banner with one of these keywords.
Display a banner with the keyword 'main' or 'top2'
Selecting a banner by size
If you need the banner to be a specific size you can specify the size as the 'what' parameter
Display a banner with width 120 and height 120
Display a banner with width 468 and height 60
3.2.2Advanced configuration of the 'what' parameter
If you want to tap in to power of the 'what' parameter and start using expressions, logical operators and different statements, please read the following section very careful.
The "what" parameter can consist of one or more expressions. Each expression will be executed when the previous expression has failed. Multiple expression must be separated with the character | and may not be separated by spaces.
If you don't provide an expression and leave the "what" parameter empty phpAdsNew match any active banner and will display one randomly.
For example if the first expression does not match any banner the second expression will be executed. If the second expression does not match any banner the third expression will be executed. This also means that if the first expression does match a banner, the second and third expression won't be executed.
You can specify as much expressions as you like, but each additional expression may require some extra system resources, such a processing time and database queries.
Each expression can consist of one or more statements. Each statement tries to match one or more banners. The simplest expression would only consist of one statement. phpAdsNew will try to find a banner that matches this statement. However, it is possible to use multiple statements and use logical operators.
The logical operators look a bit different than the ones used in MySQL and PHP, but work the same way.
Statements need to be separated by a comma (,) and a statement can begin with a switch to set the behavior. Do not put a space between the operator and the statement.
If you separate statements without a switch, the separator will become an OR operator.
If you use the + or _ switch the separator will become an AND operator. Please note: you can't use the + switch in remote invocation and must use the _ switch, which means exactly the same.statement,+statement
If you use the - switch the separator will become a NOT operator. You can use the - switch on the first statement.statement,-statement
OR takes precedence over AND and NOT. AND and NOT have equal precedence. At this moment it is not possible to use parentheses to force precedence!
Each statement tries to match a specific property of the available banners.
bannerid:[digits] or [digits]
You can match a banner by looking at the banner ID property. phpAdsNew will try to find a banner with an ID equal to the digits you specified.
You can match a banner by looking at the ID of the owner of the banner. phpAdsNew will try to find a banner, which owner's ID is equal to the digits you specified.
You can match a banner by looking at the dimension of the banner. phpAdsNew will try to find a banner with the same width and height you specified.
It is also possible to match only by looking at the width of the banner, which could be very useful if you want to try and build a vertical banner-bar.
format:[type] or html
You can match a banner by looking at the banner format. phpAdsNew will try to find a banner with the same format as the type you specified. If you want to match html banners you can use a shortcut and specify only 'html'.
You can match a banner by looking at the keywords of the banner. phpAdsNew will try to find a banner with the keyword you specified. You can use digits in your keywords, but every keyword must contain at least one character other than a digit or an 'x'. You can't use a colon (:) in your keywords.
The global keyword
In phpAdsNew you can define global banners. You can add the "global" keyword to your banners through the admin interface. Every banner with the "global" keyword will be considered a match.
The behavior only works if you are using one expression with only keywords. Otherwise you will have to add the "global" keyword to the expressions by hand.
Creating a fail-safe
In certain conditions you may want to automatically generate keywords and add these to your expression, for example:
The above example will try to display a different banner for each day of the week. On Sunday it will try to display a banner with the keyword "day0", on Monday it will try to display a banner with the keyword "day1", etc.
However if you didn't define banners any banner with the keyword "day3". phpAdsNew will not show any banners on Wednesday. You may want to create a fail-safe. If there are no banners available for a certain day you want to display a general banner. You could add some new banners and assign the keyword "general" to them. And use a construction like this:
The above example will try to display a banner for each day of the week, but if it can't find any banners on a specific day it will try to display a banner with the keyword "general".
3.2.3The clientID parameter
The optional argument clientID allows you to retrieve only banners by a specific client. Specify "" to view banners from all clients (in case you need the third or fourth argument, else don't specify it at all).
3.2.4The target parameter
The optional argument "target" allow you to specify a frame target to be used when the user clicks on the ad. For example, use '_blank' to force a new browser window to open, '_top' to replace the current window (and break frames), etc. For more information about this parameter you can take a look at the target attribute in the HTML specification.
3.2.5The source parameter
The optional argument "source" allows you to specify the name of the current page (for example: "main page" or "subpage1"). Source ACL can then use this name to allow or deny banner displays on that page.
3.2.6The withText parameter
The optional argument withText allows you to show a banner with its associated line of text below it (for example, "Support our sponsor" is a common line of text). The "WithText" parameter is turned on by default. If want to turn it of you should set this parameter to 0.
3.2.7The context parameter
The optional argument "context" is an array specifying banners to limit the search to or/and banners to be excluded from the search. It is an array containing as many associative arrays as you want. The key of the entries must either be "==" to denote a banner to which the search is limited to or "!=" to denote a banner to be excluded from the search. The value of an entry is a banner ID.
The context parameter will only work in local mode.
For example, to show the same randomly selected banner on the top and bottom of a page, you could use the following:
To make sure that the page does not show the same banner two times, you could use this:// Top of the page:
3.2.8The refresh parameter
If you want to automatically refresh the selected banner you can specify the amount of seconds between each reload. This parameter will only work for Remote Invocation for iframes.