+ Reply to Thread
Results 1 to 4 of 4

Thread: How To Replace A Code With A Word In HTML.

  1. #1
    ashwinsinha's Avatar
    ashwinsinha is offline x10 Lieutenant ashwinsinha is an unknown quantity at this point
    Join Date
    Sep 2007
    Location
    Noida, Uttar Pradesh, India
    Posts
    278

    How To Replace A Code With A Word In HTML.

    My Problem Is Quite Simple & i Believe There Must Be A Way To Solve It !
    What I Want To Do Is That I Actually Want To Replace A Code In My Page With A word Or Another Code.
    For Example,
    In My Template,
    I want to give the link to a page as
    HTML Code:
    Play (game) <a href="http://www.mydomain.com/(game).html">
    Where In Maybe The Head Tag,
    If I Give The Value
    HTML Code:
    <head><meta name=(game) value=hawx>
    The Code In My Page Is Converted To :
    HTML Code:
    Play hawx <a href="http://www.mydomain.com/hawx.html">
    & (game) in the whole page is converted to (hawx) while the page is displayed & also in the back end when the link is clicked.

    Thanking You,
    - Ashwin


  2. #2
    Scoochi2's Avatar
    Scoochi2 is offline x10 Sophmore Scoochi2 is an unknown quantity at this point
    Join Date
    Aug 2008
    Location
    Southport!
    Posts
    185

    Re: How To Replace A Code With A Word In HTML.

    This is not possible using pure HTML. You need to use a programming language to do this. A quick to implement change would be to add a simple JavaScript function that will change all instances of (game) to hawx (or anything else you want it to). But this means that it will only work on browsers that have JS, and have it enabled.

    A better way would be to use server side scripting such as PHP. You could specify a value for a variable, and just include that wherever you want the dynamic link or text to be. This will mean that not only will it work for all browsers, but it will do it more seamlessly as well.
    If anyone can see it, my post was meant for anyone who reads it. Don't take it personally or think I'm being condescending... :nuts:

  3. #3
    ashwinsinha's Avatar
    ashwinsinha is offline x10 Lieutenant ashwinsinha is an unknown quantity at this point
    Join Date
    Sep 2007
    Location
    Noida, Uttar Pradesh, India
    Posts
    278

    Re: How To Replace A Code With A Word In HTML.

    Thanx !
    I did it using VB though - im not that good at PHP !


  4. #4
    freecrm's Avatar
    freecrm is offline x10 Elder freecrm is an unknown quantity at this point
    Join Date
    May 2008
    Location
    UK
    Posts
    629

    Re: How To Replace A Code With A Word In HTML.

    Quote Originally Posted by Scoochi2 View Post
    This is not possible using pure HTML. You need to use a programming language to do this. A quick to implement change would be to add a simple JavaScript function that will change all instances of (game) to hawx (or anything else you want it to). But this means that it will only work on browsers that have JS, and have it enabled.

    A better way would be to use server side scripting such as PHP. You could specify a value for a variable, and just include that wherever you want the dynamic link or text to be. This will mean that not only will it work for all browsers, but it will do it more seamlessly as well.
    try

    <?php $new_variable = str_replace("<<<what you want changing>>>", "to whatever you want it changed to", $previous_variable);?>

+ Reply to Thread

Similar Threads

  1. Word Wrap in html tales ??
    By anuj_web in forum Programming Help
    Replies: 8
    Last Post: 05-06-2008, 08:23 PM
  2. BB Code Guide
    By Jober68 in forum Tutorials
    Replies: 1
    Last Post: 01-10-2008, 05:12 PM
  3. html code for banner ad
    By tbluhp in forum Feedback and Suggestions
    Replies: 11
    Last Post: 10-29-2006, 10:00 AM
  4. [IPB] Contiguous Board Index
    By phenetic in forum Tutorials
    Replies: 5
    Last Post: 09-18-2005, 10:31 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers