Skip navigation
PyrateJIm
Currently Being Moderated

DW cs5 using Lightbox on template page

Sep 3, 2012 6:24 AM

I am using DW cs5 on a 64-bit Windows system. I have created my template page to be used through out my site (not published as of yet). My main body is an "editable" area where I have inserted a table for pictures/thumbnails on several pages. I want to use "Lightbox" with these pictures to create a floating/pop up, larger version. The problem I am having is that when I try run the pic through "Lightbox" (once links and everything have been identified in DW) I get a DW error message that says the process can not be completed as page is locked by template, even though this is within an editable body section.

 

How do I get "Lightbox" to work as it should with these pictures without have to unlink these pages from the main template page?

 

Thanks

 
Replies
  • Currently Being Moderated
    Sep 3, 2012 6:30 AM   in reply to PyrateJIm

    Show us the code on your template page, please.  The 'locked' region likely refers not to your body's editable region, but the lack of a suitable location in the head for the javascript code.

     
    |
    Mark as:
  • Currently Being Moderated
    Sep 4, 2012 2:50 PM   in reply to PyrateJIm

    jQuery has 3 parts to it.

    • A link in the <head> tag to the core library.
    • A link in the <head> tag to the plug-in scripts and CSS files (if any).
    • A function code to invoke the plug-in.  I usually put this just before the closing </body> tag.

     

    Open your Template.dwt file.

     

    Insert the links in your <head> tags.

     

    <!--jQuery latest-->

    <script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js">

    </script>

     

    <!--Plug-in scripts, CSS-->

    <script type="text/javascript" src="../Scripts/plug-in.js"></script>

    <link href="../Styles/plug-in.css" rel="stylesheet" type="text/css">

     

    </head>

     

     

    Add function code near the bottom of your Template.

     

    <!--Plug-in function code-->

    <script type="text/javascript">

    $(document).ready(function() {

    etc....

    </script>

     

    </body>

    </html>

     

    Save Template, update child pages.

     

    Now you have most of what you need to run your plug-in on every site page.

     

    Open the child page, add images, etc.. with appropriate plug-in classes.

     

     

    Nancy O.

     
    |
    Mark as:
  • Currently Being Moderated
    Sep 4, 2012 4:21 PM   in reply to PyrateJIm

    I gave you generic basics to follow.  You must modify paths/filenames to scripts and CSS files in your site.  You also must use the appropriate function code for your particular plug-in (whatever that is). 

     

     

     

    Nancy O.

     
    |
    Mark as:
  • Currently Being Moderated
    Sep 4, 2012 4:29 PM   in reply to PyrateJIm

    Incidentally, there must be a dozen different Lightbox scripts out there.  I like Fancybox because it's flexible and you can do more than just image galleries with it.

    http://fancybox.net/howto

     

     

    Nancy O.

     
    |
    Mark as:
  • Currently Being Moderated
    Sep 5, 2012 10:20 AM   in reply to PyrateJIm

    If you don't overcome your fear of code now, you'll never make great web sites.

    Code is very simple when you understand the basics.  If you make mistakes, so what?  Everyone makes mistakes.  That's how we all learn.  Use Ctrl+Z to undo.  Use code validation tools to check your work during development.  Don't fall back on old, comfortable habits. You just won't get anywhere that way.

     

    Now, what exactly don't you understand about using Fancybox?

     

     

    Nancy O.

     
    |
    Mark as:
  • Currently Being Moderated
    Sep 7, 2012 5:35 PM   in reply to PyrateJIm

    That's boilerplate generic script. It'll never work as written verbatim because it's meaningless.

     

    Needs to be customised to your page and website. Refer post 7 from Nancy.

     

    In her post 5 she was merely outlining principles for how jQuery works. It wasn't a precise step-by-step tutorial, which I suspect you've assumed that it was.

     

    jQuery has three slots for code:

     

    1. Link to the main jQuery file
    2. Link to the specific Javascript and CSS for the plugin you want to use
    3. Add the function code to the body of the page.

     

    If you struggle with that, you may be better off paying for a commercial point-and-click WYSIWYG Lightbox solution for now.

     
    |
    Mark as:
  • Currently Being Moderated
    Sep 7, 2012 9:19 PM   in reply to PyrateJIm

    PyrateJIm wrote:

     

    It appears that some things dont play well with templates. Lightbox's happen to be one ofthem.

    No, thats not the case.

     

    Templates can have editable regions for scripts to be placed into them so dynamic widgets such as lightboxes work correctly.

     

    There's no need to link and unlink pages to and from Templates. That workflow creates unnecessary work.

     
    |
    Mark as:
  • Currently Being Moderated
    Sep 8, 2012 10:52 AM   in reply to PyrateJIm

    Why can't you put the essential Lightbox code into your Template <head> tags?

     

    Then add the images and classes to editable regions in your Child page?

     

    That's how I would do it.

     

     

    Nancy O.

     
    |
    Mark as:
  • Currently Being Moderated
    Sep 9, 2012 10:16 AM   in reply to PyrateJIm

    Open Template.dwt

     

    Change this:

     

    <link rel="stylesheet" href="lightbox_assets/css/lightbox.css" type="text/css" media="screen" />

    <script src="lightbox_assets/js/prototype.js" type="text/javascript"></script>

    <script src="lightbox_assets/js/scriptaculous.js?load=effects" type="text/javascript"></script>

    <script src="lightbox_assets/js/lightbox.js" type="text/javascript"></script>

     

    to this with leading dots and slash:

     

    <link rel="stylesheet" href="../lightbox_assets/css/lightbox.css" type="text/css" media="screen" />

    <script src="../lightbox_assets/js/prototype.js" type="text/javascript"></script>

    <script src="../lightbox_assets/js/scriptaculous.js?load=effects" type="text/javascript"></script>

    <script src="../lightbox_assets/js/lightbox.js" type="text/javascript"></script>

     

    ==============================

    Also delete this irrelevant code.

     

    <!--jQuery latest-->


    <!--Plug-in scripts, CSS-->

    <script type="text/javascript" src="../Scripts/plug-in.js"></script>

    <link href="../Styles/plug-in.css" rel="stylesheet" type="text/css" />

     

    =====================================

     

    I urge you to put your CSS code into an external style sheet.  It will make site management much easier and rid your template and child pages of repetitive code.

    http://alt-web.com/DEMOS/DW-Link-Stylesheet.shtml

     

    =======================================

     

    Save template and update pages.

     

    Can you upload your test page and support files to a web space you control and post a link here? 

     

     

    Nancy O.

     
    |
    Mark as:
  • Currently Being Moderated
    Sep 9, 2012 4:03 PM   in reply to PyrateJIm

    Jim,

    You could cut some time off this project by using Fancybox instead of this 4-level extension.

     

    Fancybox wouId take about 10 minutes to download, extract the files to your local site, paste some code into your pages and you'd be up and running.

     

    http://fancybox.net/

     

     

    Nancy O.

     
    |
    Mark as:
  • Currently Being Moderated
    Sep 10, 2012 10:21 AM   in reply to PyrateJIm

    If you want 1-2-1 help, contact me through my site.

     

    Nancy O.

    Alt-Web Design & Publishing

    Web | Graphics | Print | Media  Specialists 

    http://alt-web.com/

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points