Results 1 to 16 of 16
  1. #1
    ABW Ambassador
    Join Date
    January 18th, 2005
    Posts
    551
    I am trying to include code based on the date.

    i.e If date before 31 Nov include/write, Or if date between 01 Nov and 31 Nov include/write?

    Does anyone know a simple way to do this?

  2. #2
    ABW Ambassador
    Join Date
    January 18th, 2005
    Posts
    594
    Wayder,

    What programming language are you using?

    IamJaloppy

  3. #3
    ABW Ambassador
    Join Date
    January 18th, 2005
    Posts
    551
    None

    The site is only HTML

  4. #4
    ABW Ambassador sjangro's Avatar
    Join Date
    January 18th, 2005
    Location
    Boston
    Posts
    1,529
    You can use Javascript to test for the date and output something different before or after a given day.

    Try this.

    <pre class="ip-ubbcode-code-pre">

    &lt;html&gt;
    &lt;body&gt;

    &lt;script type="text/javascript"&gt;
    var d = new Date()
    var day = d.getDate()
    var mon = d.getMonth() + 1
    var year = d.getFullYear()

    document.write ("Today's Date: " + day + "." + mon + "." + year + "&lt;p&gt;\n")

    document.write ("Is it before Nov 31? ")
    if ((day &lt; 31) && (mon &lt;= 11)) {
    document.write("&lt;b&gt;Yes, It is before Nov 31&lt;/b&gt;")
    } else {
    document.write("&lt;b&gt;No, it is on or After Nov 31&lt;/b&gt;")
    }

    document.write ("&lt;p&gt;Is it between Nov 11 and Nov 31? ")
    if ((day &gt;= 11) && (mon == 11)) {
    document.write("&lt;b&gt;Yes, Today is between Nov 11 and 31.&lt;/b&gt;")
    } else {
    document.write("&lt;b&gt;No, Today is not between Nov 11 and 31.&lt;/b&gt;")
    }


    &lt;/script&gt;

    &lt;/body&gt;
    &lt;/html&gt;

    </pre>

    (Disclaimer: This is off the top of my head; I haven't really tested this; and there may be a better way to do it. [img]/infopop/emoticons/icon_wink.gif[/img])

    --scott

    --
    Scott Jangro
    sjangro@befree.com

  5. #5
    ABW Ambassador
    Join Date
    January 18th, 2005
    Posts
    551
    Thanks Scott, I will play with this after I have the kids in bed [img]/infopop/emoticons/icon_biggrin.gif[/img]

  6. #6
    ABW Ambassador
    Join Date
    January 18th, 2005
    Posts
    551
    [img]/infopop/emoticons/icon_biggrin.gif[/img] [img]/infopop/emoticons/icon_biggrin.gif[/img] [img]/infopop/emoticons/icon_biggrin.gif[/img] [img]/infopop/emoticons/icon_biggrin.gif[/img]
    This is how I did it.

    <pre class="ip-ubbcode-code-pre">&lt;script type="text/javascript"&gt;
    var d = new Date()
    var day = d.getDate()
    var mon = d.getMonth() + 1
    var year = d.getFullYear()

    document.write ("Is it between the specified dates?&lt;br&gt; ")
    if ((day &lt; 31) && (mon == 10) || (day &gt; 6) && (mon == 11)) {
    document.write("No, it is outside of the specified dates")
    } else {
    document.write("Yes, it is between the specified dates.")
    }
    &lt;/script&gt; </pre>


    Thanks for putting me on the right track Scott <pre class="ip-ubbcode-code-pre"> http://abw.infopop.cc/newicons/icon20.gif </pre>

    All I have to do now is to find out how to insert code instead of write.

  7. #7
    ABW Ambassador
    Join Date
    January 18th, 2005
    Posts
    551
    [img]/infopop/emoticons/icon_frown.gif[/img] [img]/infopop/emoticons/icon_frown.gif[/img] [img]/infopop/emoticons/icon_rolleyes.gif[/img]

    Well, almost.

    I want to insert two affiliate links into the "No, it is outside of the specified dates" and "Yes, it is between the specified dates" But I cant get it to work [img]/infopop/emoticons/icon_mad.gif[/img]

    Do I need to include this in a separate document and call it? Anyone know how this is done [img]/infopop/emoticons/icon_confused.gif[/img]

  8. #8
    ABW Ambassador sjangro's Avatar
    Join Date
    January 18th, 2005
    Location
    Boston
    Posts
    1,529
    Wayder,

    Not sure what you are trying to do without seeing your code, but you should be able to enclose the entire HTML code inside the quotes of the document.writes. (Don't put any linebreaks in there.)

    Or, post your code and I'd be happy to take a look.

    By the way, you should put some extra parentheses in there to make sure the &&'s get done before the ||. like this:

    if ( ( (day &lt; 31) && (mon == 10) ) || ( (day &gt; 6) && (mon == 11) ) ) {

    I think &&'s will precede ||'s anyway, but it doesn't hurt to be safe.

    --scott

    --
    Scott Jangro
    sjangro@befree.com

  9. #9
    ABW Ambassador
    Join Date
    January 18th, 2005
    Posts
    551
    <BLOCKQUOTE class="ip-ubbcode-quote"><font size="-1">quote:</font><HR>
    you should put some extra parentheses in there to make sure the &&'s get done before the ||. like this:
    <HR></BLOCKQUOTE>

    Just think back to math lessons, Mmmmmm, thinking back. hhoooooommmm [img]/infopop/emoticons/icon_smile.gif[/img]

    This is waht I am trying to do:

    &lt;script type="text/javascript"&gt;
    var d = new Date()
    var day = d.getDate()
    var mon = d.getMonth() + 1
    var year = d.getFullYear()

    if (((day &lt; 25) && (mon == 10)) || ((day &gt; 31) && (mon == 10))) {
    document.write("&lt;a href="http://www.qksrv.net/click-xxxxxxx-xxxxxxx" target="_top"&gt;Link Text Here&lt;/a&gt;&lt;img src="http://www.qksrv.net/image-xxxxxxx-xxxxxxx" width="1" height="1" border="0"&gt;")
    } else {
    document.write("&lt;a href="http://www.qksrv.net/click-xxxxxxx-xxxxxxx" target="_top"&gt;Link Text Here&lt;/a&gt;&lt;img src="http://www.qksrv.net/image-xxxxxxx-xxxxxxx" width="1" height="1" border="0"&gt;")
    }
    &lt;/script&gt;


    Maybe I should explain further so you fully understand my intention.

    Merchants continuously set up special offers that are date restricted, and I dont always have the time to keep up with them, which leaves incorrect information on my site. So I thought that I would create two links that could be auto replaced based on the date.

    One link would be "Speshul offur, buy it here"
    the other "normal offer buy it here"

    This will mean that I can write and forget rather that worry about incorrect promotion.

  10. #10
    ABW Ambassador sjangro's Avatar
    Join Date
    January 18th, 2005
    Location
    Boston
    Posts
    1,529
    <BLOCKQUOTE class="ip-ubbcode-quote"><font size="-1">quote:</font><HR>
    Maybe I should explain further so you fully understand my intention.

    Merchants continuously set up special offers that are date restricted, and I dont always have the time to keep up with them, which leaves incorrect information on my site. So I thought that I would create two links that could be auto replaced based on the date.
    <HR></BLOCKQUOTE>

    Yeah, that's what I figured.

    The double-quotes in your HTML is confusing the javascript. Any d-quote that is your html and not javascript needs to be escaped with a backslash, like this:

    &lt;script type="text/javascript"&gt;
    var d = new Date()
    var day = d.getDate()
    var mon = d.getMonth() + 1
    var year = d.getFullYear()

    if (((day &lt; 25) && (mon == 10)) || ((day &gt; 31) && (mon == 10))) {
    document.write("&lt;a href=\"http://www.qksrv.net/click-xxxxxxx-xxxxxxx\" target=\"_top\"&gt;Link Text Here&lt;/a&gt;&lt;img src=\"http://www.qksrv.net/image-xxxxxxx-xxxxxxx\" width=\"1\" height=\"1\" border=\"0\"&gt;")
    } else {
    document.write("&lt;a href=\"http://www.qksrv.net/click-xxxxxxx-xxxxxxx\" target=\"_top\"&gt;Link Text Here&lt;/a&gt;&lt;img src=\"http://www.qksrv.net/image-xxxxxxx-xxxxxxx\" width=\"1\" height=\"1\" border=\"0\"&gt;")
    }
    &lt;/script&gt;

    If I got them all, that should work.

    Now what's this qksrv crap? Go get a bfast link. [img]/infopop/emoticons/icon_wink.gif[/img]

    --scott

    --
    Scott Jangro
    sjangro@befree.com

  11. #11
    Affiliate Marketing Consultant Andy Rodriguez's Avatar
    Join Date
    January 18th, 2005
    Location
    Sunny Miami
    Posts
    8,384
    <BLOCKQUOTE class="ip-ubbcode-quote"><font size="-1">quote:</font><HR>Originally posted by Scott - Be Free:

    Now what's this qksrv crap? Go get a bfast link. [img]/infopop/emoticons/icon_wink.gif[/img]

    --scott

    --
    Scott Jangro
    sjangro@befree.com<HR></BLOCKQUOTE>

    Classic !!

    Andy Rodriguez,
    Online Advertising / Affiliate Marketing Manager

    TigerDirect.com
    P: (305) 415-2313
    E: andy.rodriguez@tigerdirect.com
    ICQ: 175010
    AIM: miamitigercub

  12. #12
    "An Englishman In New York" TJ's Avatar
    Join Date
    January 18th, 2005
    Posts
    3,282
    <BLOCKQUOTE class="ip-ubbcode-quote"><font size="-1">quote:</font><HR>
    <BLOCKQUOTE class="ip-ubbcode-quote"><font size="-1">quote:</font><HR>Originally posted by Scott - Be Free:

    Now what's this qksrv crap? Go get a bfast link. [img]/infopop/emoticons/icon_wink.gif[/img]

    --scott

    --
    Scott Jangro
    sjangro@befree.com<HR></BLOCKQUOTE>

    Classic !!

    <HR></BLOCKQUOTE>

    I noticed that Scott is a little paraniod about these things! hehehehe [img]/infopop/emoticons/icon_biggrin.gif[/img]

  13. #13
    ABW Ambassador sjangro's Avatar
    Join Date
    January 18th, 2005
    Location
    Boston
    Posts
    1,529
    Nah, just being funny. However as they say...

    "A little paranoia is healthy"
    -- "they", repeated by every senior exec I've ever known.

    "If paranoia is healthy I'm gonna outlive all you motherf*****s."
    -- George Carlin

    --
    Scott Jangro
    sjangro@befree.com

  14. #14
    ABW Ambassador
    Join Date
    January 18th, 2005
    Posts
    551
    [img]/infopop/emoticons/icon_eek.gif[/img] I am suitably chastised, and I just signed up. OK?

    Many thanks for your help. It works [img]/infopop/emoticons/icon_biggrin.gif[/img] [img]/infopop/emoticons/icon_biggrin.gif[/img] [img]/infopop/emoticons/icon_biggrin.gif[/img]

  15. #15
    Affiliate Marketing Consultant Andy Rodriguez's Avatar
    Join Date
    January 18th, 2005
    Location
    Sunny Miami
    Posts
    8,384
    <BLOCKQUOTE class="ip-ubbcode-quote"><font size="-1">quote:</font><HR>Originally posted by Wayder:
    and I just signed up. OK?

    Many thanks for your help. It works [img]/infopop/emoticons/icon_biggrin.gif[/img] [img]/infopop/emoticons/icon_biggrin.gif[/img] [img]/infopop/emoticons/icon_biggrin.gif[/img]<HR></BLOCKQUOTE>

    Now set up some BF/Tiger links and watch the money roll in.... [img]/infopop/emoticons/icon_razz.gif[/img] [img]/infopop/emoticons/icon_razz.gif[/img]

    Tell me, what can I do today to help you make money?

    Andy Rodriguez,
    Online Advertising / Affiliate Marketing Manager

    TigerDirect.com
    P: (305) 415-2313
    E: andy.rodriguez@tigerdirect.com
    ICQ: 175010
    AIM: miamitigercub

  16. #16
    ABW Ambassador
    Join Date
    January 18th, 2005
    Posts
    551
    <BLOCKQUOTE class="ip-ubbcode-quote"><font size="-1">quote:</font><HR>Now set up some BF/Tiger links and watch the money roll in....<HR></BLOCKQUOTE>

    Dua lau Ban = Yes Boss.

    <BLOCKQUOTE class="ip-ubbcode-quote"><font size="-1">quote:</font><HR>
    Tell me, what can I do today to help you make money?<HR></BLOCKQUOTE>

    Actually, the easiest way for me is if I just send you my account details, I can tell you later how much [img]/infopop/emoticons/icon_wink.gif[/img] [img]/infopop/emoticons/icon_biggrin.gif[/img] [img]/infopop/emoticons/icon_biggrin.gif[/img] [img]/infopop/emoticons/icon_razz.gif[/img]

    Suppose I will have to do some work though

    I will PM or "POP you one" later.

  17. Newsletter Signup

+ Reply to Thread

Similar Threads

  1. How to include a database?
    By Aphiliac in forum ShareASale - SAS
    Replies: 7
    Last Post: January 7th, 2008, 06:58 PM
  2. Help With Include Tag
    By mintchap in forum WebMerge (Fourthworld.com)
    Replies: 1
    Last Post: September 14th, 2007, 06:26 PM
  3. Event Date vs. Posting Date
    By Rodski in forum Commission Junction - CJ
    Replies: 4
    Last Post: November 18th, 2005, 11:59 AM
  4. To include or not to include that is the question
    By Heyder in forum Search Engine Optimization
    Replies: 8
    Last Post: October 1st, 2002, 05:05 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •