> 1 <
| Author | Message |
Nico
2 posts
Location: France Occupation: Age: |
#233 2008-03-01 19:57 GMT |
|
Hello,
I want display different advertisement code in my website for each category. So I try to make a plugin. The problem is to identify the category of the page.. For the "list pages", no problem because I can use the $c variable. But for page I don't know how to make selection of the page_cat in the plugin. Below a test code : it works for the "list" pages but not for the "page" pages Have you any idea to solve my problem ??? Thanks. Code: switch ($location) {
case "Home": $target = "homepage"; break; case "List": $target = $c; break; case "Pages": $target = $pag['page_cat']; break; default: $target = "other"; } switch ($target) { case "homepage": $myadscode = "My code ads for the homepage"; case "mycat1": $myadscode = "My code ads for the cat 1"; case "mycat2": $myadscode = "My code ads for the cat 2"; case "mycat3": $myadscode = "My code ads for the cat 3"; case "mycat4": $myadscode = "My code ads for the cat 4"; ... ... default: $myadscode = "My Default Ads Code"; } |
|
Kilandor
118 posts
http://www.seditioforge.com/ Location: United States TN Occupation: Web Coder - Gamer - Game Devloper(working on it) Age: 23 |
#234 2008-03-01 20:09 GMT |
|
Where, are you hooking into, I'm assuming in the header?
If so, you will have to do a SQL query to grab the page_cat in pages section. |
|
Nico
2 posts
Location: France Occupation: Age: |
#236 2008-03-01 20:18 GMT |
|
Oh Thanks... I'm silly to forget the make the sql query in the plugin itself and no only get it as a global variable !
And it's not to be hooking... It's to be working in header.tpl, footer.tpl, list.tpl, page.tpl, etc... And I still use the old LDU so I make this plugin with "wrapper global plugin" Thanks again. |
|
> 1 <



