How do I swap these variables over to hard-code?

Discussion in 'JavaScript' started by JakeThePeg, Nov 22, 2009.

  1. #1
    Hi - I have this really nice piece of code which creates dynamic Flash titles on my blog. However, I'd like to hard-code a few Flash titles on one of my page templates, rather than use the dynamic text.

    I'm a coding amateur, so which variables in the below code should I change to hard-code the title?

    <div class="post" id="post-<?php the_ID(); ?>">
    	<div class="storytitle">
    		<div class="title" id="flash-<?php the_ID(); ?>">
    			<a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a>
    		</div>
    		<script type="text/javascript">
    			// <![CDATA[
    			var so = new SWFObject("<?php bloginfo('template_directory'); ?>/title.swf", "flash-<?php the_ID(); ?>", "240", "240", "8", "#ffffff");
    			so.addVariable("titletext", "<?php the_title(); ?>");
    			so.addVariable("permalink", "<?php the_permalink() ?>");
    			so.write("flash-<?php the_ID(); ?>");
    			// ]]>
    		</script>
    	</div>
    Code (markup):
     
    JakeThePeg, Nov 22, 2009 IP
  2. japanninja

    japanninja Active Member

    Messages:
    54
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    50
    #2
    
    <?php the_title(); ?>
    
    Code (markup):
    should be your choice.
     
    japanninja, Nov 22, 2009 IP
  3. camjohnson95

    camjohnson95 Active Member

    Messages:
    737
    Likes Received:
    17
    Best Answers:
    0
    Trophy Points:
    60
    #3
    so.addVariable("titletext", "<?php the_title(); ?>");
    Change to:
    so.addVariable("titletext", "My Static Title");
    on the pages that you want the title to be static, just change the text to whatever you want...
     
    camjohnson95, Nov 23, 2009 IP
  4. JakeThePeg

    JakeThePeg Active Member

    Messages:
    230
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    53
    #4
    Yeah, I tried that, but it wouldn't let me add more than one title to the page. So I created images for the titles instead of using flash :)
     
    JakeThePeg, Nov 23, 2009 IP