Welcome to TalkGraphics.com
Page 1 of 2 12 LastLast
Results 1 to 10 of 14

Hybrid View

  1. #1
    Join Date
    Nov 2016
    Posts
    9

    Default Inserting today's date in a web site

    Is there a way to insert the current date on a web page in Xara?

  2. #2
    Join Date
    Aug 2000
    Location
    Placitas, New Mexico, USA
    Posts
    41,503

    Default Re: Inserting today's date in a web site

    Hi Marc - Here's a link I came up with for a search on the above https://duckduckgo.com/?q=code+to+in...&t=ffsb&ia=web

    I don't think there is a native way to do this in Xara.

    Code:
    <script language="JavaScript">
    <!--
    date=Date()
    document.write(date)
    //-->
    </script>
    One of the more savvy members might suggest how to apply this.

  3. #3
    Join Date
    Apr 2012
    Location
    SW England
    Posts
    17,822

    Info Re: Inserting today's date in a web site

    Here goes:

    1. Text Tool: Create a Text Column with "Today's Date" in any font, style or format.
    2. Text Tool: Add the following Names to the selected Text: htmlblocktext & today (separately).
    3. Select Tool: Select the text object and then Utilities > Web Properties > Placeholder > HTML Code Insertion > HTML code (body), add:
      Code:
      <script>
        document.getElementById("today").innerHTML = Date().substr(4, 11);
      </script>
    4. Done.

    Change the range of the substr parameters to extract more or less as you need; drop it altogether to get the full Date() value ... = Date();].

    Example file: JS-Today.xar.

    Acorn
    Acorn - installed Xara software: Cloud+/Pro+ and most others back through time (to CC's Artworks). Contact for technical remediation/consultancy for your web designs.
    When we provide assistance, your responses are valuable as they benefit the community. TG Nuggets you might like. Report faults: Xara Cloud+/Pro+/Magix Legacy; Xara KB & Chat

  4. #4
    Join Date
    Nov 2016
    Posts
    9

    Default Re: Inserting today's date in a web site

    Thanks. Works like a charm.

  5. #5
    Join Date
    Apr 2012
    Location
    SW England
    Posts
    17,822

    Default Re: Inserting today's date in a web site

    Quote Originally Posted by Marc Erdrich View Post
    Thanks. Works like a charm.
    Marc, kind of you to report back.

    Acorn
    Acorn - installed Xara software: Cloud+/Pro+ and most others back through time (to CC's Artworks). Contact for technical remediation/consultancy for your web designs.
    When we provide assistance, your responses are valuable as they benefit the community. TG Nuggets you might like. Report faults: Xara Cloud+/Pro+/Magix Legacy; Xara KB & Chat

  6. #6
    Join Date
    Sep 2000
    Location
    Bracknell, UK
    Posts
    8,659

    Default Re: Inserting today's date in a web site

    Quote Originally Posted by Marc Erdrich View Post
    Is there a way to insert the current date on a web page in Xara?
    Are you expecting visitors that don't know what day it is?

  7. #7
    Join Date
    Aug 2000
    Location
    Placitas, New Mexico, USA
    Posts
    41,503

    Default Re: Inserting today's date in a web site

    Are you expecting visitors that don't know what day it is?
    Or perhaps, the appearance of a website that is current to the day.

  8. #8
    Join Date
    May 2014
    Location
    Australia: GMT+10
    Posts
    265

    Default Re: Inserting today's date in a web site

    Which side of GMT's date are you going to display? Whichever it is, half of the world will see the wrong date!

  9. #9
    Join Date
    Apr 2012
    Location
    SW England
    Posts
    17,822

    Default Re: Inserting today's date in a web site

    Quote Originally Posted by jaydear View Post
    Which side of GMT's date are you going to display? Whichever it is, half of the world will see the wrong date!
    Any GMT date is accurate if it displays the date & Time for any part of the world.

    There are JS methods to convert raw Date() values [e.g., Tue Nov 12 2019 15:03:51 GMT+0000 (GMT Standard Time)] to local time...

    I was simply demonstrating the structure of add JS code to an existing Xara Text Object and flexibly retaining its position and formatting without extra code.

    Acorn
    Acorn - installed Xara software: Cloud+/Pro+ and most others back through time (to CC's Artworks). Contact for technical remediation/consultancy for your web designs.
    When we provide assistance, your responses are valuable as they benefit the community. TG Nuggets you might like. Report faults: Xara Cloud+/Pro+/Magix Legacy; Xara KB & Chat

  10. #10
    Join Date
    Nov 2016
    Posts
    9

    Default Re: Inserting today's date in a web site

    Thanks all for the helpful (and occasionally silly) comments.

 

 

Bookmarks

Posting Permissions

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