Welcome to TalkGraphics.com
Page 1 of 2 12 LastLast
Results 1 to 10 of 14
  1. #1
    Join Date
    Nov 2016
    Posts
    7

    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
    37,434

    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.
    Gary W. Priester
    Mr. Moderator Emeritus Dude
    , Sir

    gwpriester.com | Custom-Stereograms.com | eyeTricks on Facebook






  3. #3
    Join Date
    Apr 2012
    Location
    SW England
    Posts
    10,240

    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 - My currently active Xara software: XDPX (current, v15, v12 & 11 (64-bit)), unserviced XWD Premium 15 & 12, XPGD10, X3D7; lots of licences back through time (to CC's Artworks). If your Post identifies a Xara software fault, please raise it directly with Magix --> support2.magix.com.

  4. #4
    Join Date
    Sep 2000
    Location
    Bracknell, UK
    Posts
    8,136

    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?

  5. #5
    Join Date
    Aug 2000
    Location
    Placitas, New Mexico, USA
    Posts
    37,434

    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.
    Gary W. Priester
    Mr. Moderator Emeritus Dude
    , Sir

    gwpriester.com | Custom-Stereograms.com | eyeTricks on Facebook






  6. #6
    Join Date
    May 2014
    Location
    Australia: GMT+10
    Posts
    182

    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!

  7. #7
    Join Date
    Sep 2000
    Location
    Bracknell, UK
    Posts
    8,136

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

    Quote Originally Posted by gwpriester View Post
    Or perhaps, the appearance of a website that is current to the day.
    Gary my websites are current for every day! LOL

    I don't think changing the date everyday will make the rest of the page current.

  8. #8
    Join Date
    Aug 2000
    Location
    Placitas, New Mexico, USA
    Posts
    37,434

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

    Acorn - The file you posted did not have any of the names, code you suggested added.

    I think this works for what you have suggested.
    Attached Files Attached Files
    Gary W. Priester
    Mr. Moderator Emeritus Dude
    , Sir

    gwpriester.com | Custom-Stereograms.com | eyeTricks on Facebook






  9. #9
    Join Date
    Apr 2012
    Location
    SW England
    Posts
    10,240

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

    Quote Originally Posted by gwpriester View Post
    Acorn - The file you posted did not have any of the names, code you suggested added.
    I think this works for what you have suggested.
    Gary, if it displayed the date then the code detail is all there.
    Click image for larger version. 

Name:	Screenshot 2019-11-12 14.43.12.png 
Views:	8 
Size:	17.0 KB 
ID:	125555Click image for larger version. 

Name:	Screenshot 2019-11-12 13.08.36.png 
Views:	8 
Size:	10.6 KB 
ID:	125556

    Your file's code matches mine so either will do. You placed the JS in the Placeholder, mine's in the Page, so my descriptive mistake, which is benign.
    Page is better if you intent to propagate lots of current date's around the page; the id "today" would need changing to htmlclass="today" and the JS 'document.getElementById("today").innerHTML = Date().substr(4, 11);' would need to become 'document.getElementsByClassName("today").innerHTML = Date().substr(4, 11);'. The JS is need in the Website HTML Code (head) if it is going to be on every page.

    Acorn
    Acorn - My currently active Xara software: XDPX (current, v15, v12 & 11 (64-bit)), unserviced XWD Premium 15 & 12, XPGD10, X3D7; lots of licences back through time (to CC's Artworks). If your Post identifies a Xara software fault, please raise it directly with Magix --> support2.magix.com.

  10. #10
    Join Date
    Apr 2012
    Location
    SW England
    Posts
    10,240

    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 - My currently active Xara software: XDPX (current, v15, v12 & 11 (64-bit)), unserviced XWD Premium 15 & 12, XPGD10, X3D7; lots of licences back through time (to CC's Artworks). If your Post identifies a Xara software fault, please raise it directly with Magix --> support2.magix.com.

 

 

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
  •