Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - Using strSubject
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Using strSubject

 Post Reply Post Reply
Author
MortiOli View Drop Down
Senior Member
Senior Member
Avatar

Joined: 26 May 2002
Location: United Kingdom
Status: Offline
Points: 514
Post Options Post Options   Thanks (0) Thanks(0)   Quote MortiOli Quote  Post ReplyReply Direct Link To This Post Topic: Using strSubject
    Posted: 01 October 2009 at 9:23am
Sorry if this is a really easy problem to solve, but I'm a PHP programmer, so don't know a lot about ASP...

On my WWF forum, I have an advert at the top (where the WWF Google Ads usually appear), which I can specify keywords for.  What I'd like to do is to use the topic title (strSubject) as the keywords, with each word separated by + signs, BUT if the user is on another page (ie, Active Users etc), then a default set of keywords is used.

I managed to get half of this done, but having problems with errors saying variable undefined on some pages, then variable already defined on others when I define it.

Could someone please help?

Thanks!


Back to Top
Scotty32 View Drop Down
Moderator Group
Moderator Group


Joined: 30 November 2002
Location: Manchester, UK
Status: Offline
Points: 1682
Post Options Post Options   Thanks (0) Thanks(0)   Quote Scotty32 Quote  Post ReplyReply Direct Link To This Post Posted: 01 October 2009 at 11:48am
I would define a new variable at the bottom of the common.asp file say
dim strMortiKeywords

(to make sure its 'unique')

Then set your 'default' keywords under it like so
dim strMortiKeywords
strMortiKeywords = "my+keywords+for+advert"


Then in the forum_posts.asp  file set the bottom of the ASP section, before the HTML starts this:

strMortiKeywords = strSubject


To get the + in, you can either use
strMortiKeywords = Server.URLEncode(strSubject)


or
strMortiKeywords = Replace(strSubject," ", "+")


The Replace method will only replace spaces with the + sign, if (as i suspect) you need it for a URL, then the URL Encode method would be better as it'll make sure the subject is "URL Friendly"

Then pass it to your advert, as you are already with strSubject

You can then set your custom variable on any other pages with say forum titles on forum pages or anything else if you wished.
S2H.co.uk - WebWiz Mods and Skins

For support on my mods + skins, please use my forum.
Back to Top
MortiOli View Drop Down
Senior Member
Senior Member
Avatar

Joined: 26 May 2002
Location: United Kingdom
Status: Offline
Points: 514
Post Options Post Options   Thanks (0) Thanks(0)   Quote MortiOli Quote  Post ReplyReply Direct Link To This Post Posted: 01 October 2009 at 12:39pm
Thanks Scotty, perfect!
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.