Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    New to the CF scene
    Join Date
    May 2011
    Posts
    3
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Exclamation how to display a changeing number eg "displaying tip 1 of XX" where xx changes

    i have several "tips" on my website that i offer. I number these tips eg "displaying tip 27 of 56". Because i am adding to these tips i want to know how i can set the "56" to a look up the current number im at. Eg if i add 4 more tips today - i goto my file (excel or php or what ever) and change my total to "60" then every display on all my pages changes to reflect i have 60 tips now. So the same tip, when next viewed would say "displaying tip 27 of 60". This way i dont have to manually change every page on my website that has these tips on them.

    Any ideas would be greatly welcomed

  • #2
    New to the CF scene
    Join Date
    May 2011
    Posts
    8
    Thanks
    1
    Thanked 1 Time in 1 Post
    I am not completely sure what you mean, but I have seen in my own experiences that if you want one element to change on several pages without you manually going to every page, using a template for those pages would be the best way to go. That way whenever you change one thing on the template, every page with the template applied to it changes, as well.

    Again, I'm not sure if that's exactly what you were asking, but I know that if I wanted to change something that affects my whole website, I would be using the website's template to do it.

  • Users who have thanked Suvi for this post:

    nadley (05-14-2011)

  • #3
    New to the CF scene
    Join Date
    May 2011
    Posts
    3
    Thanks
    2
    Thanked 0 Times in 0 Posts

    cant use templates

    Quote Originally Posted by Suvi View Post
    I am not completely sure what you mean, but I have seen in my own experiences that if you want one element to change on several pages without you manually going to every page, using a template for those pages would be the best way to go. That way whenever you change one thing on the template, every page with the template applied to it changes, as well.

    Again, I'm not sure if that's exactly what you were asking, but I know that if I wanted to change something that affects my whole website, I would be using the website's template to do it.
    Thanks Suvi
    I cant use a template because each tip is unique and its number remains the same. Its just the total number if tips id like to have change on each page, as they grow.

  • #4
    New to the CF scene
    Join Date
    May 2011
    Posts
    8
    Thanks
    1
    Thanked 1 Time in 1 Post
    Quote Originally Posted by nadley View Post
    Thanks Suvi
    I cant use a template because each tip is unique and its number remains the same. Its just the total number if tips id like to have change on each page, as they grow.
    Are the tips static images or text? If text, while this is a little clunky, you can always do something like this:

    Code:
    This is tip number
    <!-- TemplateBeginEditable name="tipnumber" -->
    27
    <!-- TemplateEndEditable -->
    of 60:
    <!-- TemplateBeginEditable name="tip" -->
    Remember to put those end brackets in, because otherwise your website won't work and you'll be sad.
    <!-- TemplateEndEditable -->
    So, with the 'of 60' outside of the editable region, and the actual tip # and then the tip itself in the editable regions, you can easily edit the total number of tips in the template while not changing the rest of the pages.

    Oh, I should also mention that's the code that Dreamweaver gave me for my editable regions for my pages that use a template. I have no idea if that is how it goes everywhere else
    Last edited by Suvi; 05-14-2011 at 12:12 PM.

  • #5
    Banned
    Join Date
    Feb 2011
    Posts
    2,699
    Thanks
    13
    Thanked 395 Times in 395 Posts
    What about putting your tips in an array and looping through it or whatever.

    The total tips "xx" will then simply be the value of the length property of the array.

  • Users who have thanked bullant for this post:

    nadley (05-14-2011)

  • #6
    New to the CF scene
    Join Date
    May 2011
    Posts
    3
    Thanks
    2
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by bullant View Post
    What about putting your tips in an array and looping through it or whatever.

    The total tips "xx" will then simply be the value of the length property of the array.
    ideally id like to just have a php form with one value in it say "xx" (the total number of tips), i could then manually ajust it each time i add a tip and then just look up the total number (in that form) on each page.

    Then in my page put my html like this

    <span style="font-size: 10px"><em>Tip 30/[xx insert wonderful code that looks up my form ...here] (more available to premium members)</em></span>

    but in new to html so i have no idea how to do this

  • #7
    Banned
    Join Date
    Feb 2011
    Posts
    2,699
    Thanks
    13
    Thanked 395 Times in 395 Posts
    Without seeing your actual code where you store the tips, I have only a vague idea of what you are trying to do.

    But anyway, even if using php, I would think you could put your tips in a php array (if using a database is over-kill) in a php include file. You could then store the length of the array (got by using count()) in either a variable, session variable or constant and use it wherever you need to display the total number of tips.

    Whenever you added or removed tips from the array, the length of the updated array would be got automatically using count().


  •  

    Posting Permissions

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