Skip to main content
The Gfrow
Participating Frequently
May 3, 2018
Answered

Global Blocks or sections

  • May 3, 2018
  • 3 replies
  • 708 views

Is there a way to make global blocks or sections that I can just insert when I need a new one and add then add the page-specific content for that section?

For example, I made section with a title, sub-title, paragraph, and three icons with buttons. I want to use this section in several place on my site but add different icons and text etc. Can I make templates for those and just insert them, rather than having to copy and paste?

Thanks

This topic has been closed for replies.
Correct answer BenPleysier

Is this what you are looking for Learn how to reuse code in Dreamweaver with the Snippets panel

3 replies

The Gfrow
The GfrowAuthor
Participating Frequently
May 3, 2018

FML

The Gfrow
The GfrowAuthor
Participating Frequently
May 3, 2018

Thanks Jon, I am familiar with the php include function but I think the all content would have to remain the same, right?

I want a template shell that I can fill in the specific content for a specific page on the fly, but for the framework to be the same and globally editable.

So I design a section with empty fields, insert to x,y, and z pages each with specific content in the blanks. Later I want to add a <div> let's say to the template and it would create that section globally n looking eveyrhing else in tact.

Jon Fritz
Community Expert
Community Expert
May 3, 2018

You can use includes for that too.

Basically "everything before the editable area" can be one include and "everything after the editable area" could be another. Personally, I use a half dozen or so includes per page like navigation, header, footer, sidebar, sub-menu, etc. The actual code of most of my pages is pretty light, since most of it comes in from a handful of single-line include calls that are added by the server.

The Gfrow
The GfrowAuthor
Participating Frequently
May 3, 2018

Jon,

I don't totally follow.

So let's say I have this as the frame for what my section will look like:

<section>

  <div class="PLACEHOLDER-BORDER">

  <img src="PLACEHOLDER" alt="PLACEHOLDER">

  <p>PALCEHOLDER TEXT</p>

  <button>PLACEHOLDER</button>

  </div>  

  <section>

All of the "PLACEHOLDERS" I would add to on specific pages since the content would change. Say, later, I might want to add an <h2> under the <h1> at some point and insert that dynamically,how might I go about doing what you're saying? I realize I'd have to go to each individual page and write out what I want in the newly added <h2>, but... Shit, now I'm confusing myself.

BenPleysier
Community Expert
BenPleysierCommunity ExpertCorrect answer
Community Expert
May 3, 2018
Wappler is the DMXzone-made Dreamweaver replacement and includes the best of their powerful extensions, as well as much more!
The Gfrow
The GfrowAuthor
Participating Frequently
May 3, 2018

Ben, thank you so much for this! I think this should do what I need. I did read, however,  that there's no way to update all instances once I've put them in place so I'll have to make sure that it's the structure is what I want from the get-go  (less CSS of course), unless you kmow a workaround for that.  Thank you again!

Jon Fritz
Community Expert
Community Expert
May 3, 2018

The best way to do this would be to use php or shtml server side includes.

Essentially, you would have an include file which contains only the code of the item you're re-using throughout your site. You would then call that file within your php or shtml pages and the server will write whatever's in the include to the page. If you need to make a side-wide modification, you only need to change the include file and upload it, the server handles the rest.

PHP Tutorial - Include File

SSI: The Include Command