Copy link to clipboard
Copied
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
Is this what you are looking for Learn how to reuse code in Dreamweaver with the Snippets panel
Copy link to clipboard
Copied
Is this what you are looking for Learn how to reuse code in Dreamweaver with the Snippets panel
Copy link to clipboard
Copied
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!
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
https://forums.adobe.com/people/The+Gfrow wrote
... now I'm confusing myself.
LOL, you're not alone (it might just be the terminology you're using).
You're not really looking for global editing (change one file and all pages using that file change), you want dynamic content (different info populating areas depending on the page being viewed). Possibly both.
What it appears you're talking about now would be best achieved with database driven content filling in the PLACEHOLDER items dependent upon what page is called.
Copy link to clipboard
Copied
YES!
And now the question remains HTF do I do that in Dreamweaver?
I have a local environment setup with MAMP, I've gotten it to work with PHP&MySQL, but I'm not sure what to do from there.
I've always used Wordpress so I get the dynamic part(I understanding the include function, Db tables etc), but for the past year I've been learning PHP, MySQL, CSS, and dabbling in Java (but I super suck at that. Primarily because I only recently found out what it actually does) and now I'm here...
In other words, I don't have all the fancy terminology, but I get how it should work.
Any leads in the right direction would be amaze-balls and super appreciated.
Copy link to clipboard
Copied
Well, unfortunately, there's nothing built into DW anymore that will help, the old database panels were removed due to being massively outdated. The base program needs you to know how to hand-code that type of thing yourself.
However, there are alternatives, if you have a budget.
A couple of companies have updated, paid database connection extensions that would help in this situation. DMXZone and WebAssist.
Copy link to clipboard
Copied
it look like if you was looking like an alternative to Angular, React or Express, but in PHP... am I right.. or did I miss your query ?
Copy link to clipboard
Copied
Birnou,
I was originally trying to find out how to make snippets that I could edit globally. I have never used Angular so I don't even know where to begin with that.
If you have any suggestions I'm all ears.
Copy link to clipboard
Copied
well, if you don't know angular, react or express (I prefer express) the metaphor exemple is not well suited...
to make it short and simple... (very short... but you'll get the idea)
say that you have an HTML document
<body>
<h1>title</h1>
<p>document informations and articles</p>
<body>
now, if you want to fill up the document depending on request and pages... you use template engine base on pseudo language and use of variable and/or placeholder directly inside the document as
<body>
<h1>{{title}}</h1>
<p>{[content.article:ID.text}}</p>
<body>
then wen sending a JSON file containing all the dats in merge with the document, it will fill the page...
you can also have different template base on the URL path
so to be back to my initial question, is this this type of mecanics that you are looking for... but based on PHP (because Angular, React, Express are JavaScript based)
Copy link to clipboard
Copied
Yes, dynamic insertion! I don't know really know how per se. Any thoughts?
Copy link to clipboard
Copied
the insertion of data from a database and the dynamic model system are not exactly the same approach, nor the same philosophy.
a lot of dynamic template insertion tools also use a pseudo HTML type PUG for example, or Jade ... ditto for scripts ... that's why I find Node.js quite revolutionary and that allows to develop web applications much faster than going through a multi-language client/server relationship
at the beginning, by participating in this discussion, I did not formulate an answer but I tried to better understand your question
Copy link to clipboard
Copied
FML