- This topic is empty.
-
AuthorPosts
-
January 23, 2015 at 11:21 am #194106bearheadParticipant
Hey, this isn’t a js question per se, so I put it in this forum.
I’m working on a website for my engineering firm that has over 300 separate pages for their projects. In order to improve maintainability, I created one “template” page for all the projects. That template gets included via php on to a projects file’s index.html page, and then content is inserted in via javascript.
It is kind of convoluted, but the benefit is that if my boss wants something changed that requires editing html, I only need to do it once to the template document and not 300 times to each project file.
However, this make the site pretty much totally dependent upon javascript… is that smart? Should I be going about it in a different way? Is there an equivelent to this script:
$(".quote").load("project_data.html #quote");
in php I could use?here is an example project so you can see what I have going on: http://www.aeieng.com/new_aei/project1/
January 23, 2015 at 5:54 pm #194122ShikkedielParticipantThis answer on Stackoverflow looks like a php alternative :
http://stackoverflow.com/a/9539996/3168107
And yes, it’s probably a better approach then loading everything with JavaScript. If only for general search engine indexing…
January 27, 2015 at 8:21 am #194343Paulie_DMemberWhat I need to do is take the content from specific divs on one document, and then insert it into other specific divs in another document.
Ugh…
The answer Shikkediel gave was specifically stated to be a PHP alternative which is designed to use templates like that.
It’s gotta be a much better option that this “cloning” or “cut and pasting”.
January 27, 2015 at 8:46 am #194345ShikkedielParticipantIf the original HTML files should be kept as they are, it’s probably preferable to use
file_get_contents
so the data can be ‘hacked up’. To be able to discern the elements from each other, we come into an area I know little about – one would need a regex or parser library.Were the job up to me, I’d make smaller templates of the original files and insert them separately into the document – with the
readfile
method orinclude
with echoed HTML even.Edit – also in response to nkrisc, I think this is a basic CMS of sorts…
-
AuthorPosts
- The forum ‘Other’ is closed to new topics and replies.