How do you structure your website content? - web-architecture

Do you try to keep it simple and have a root folder and then 1 folder for images, javascript, flash, etc? What do you normally call your folders? Do you give your files naming conventions?

not a standard way.. but from my experience, I come up with this structure:
root/
-> images/
-> <subfolder>
-> upload
-> js/
-> css/
-> data/
-> docs/
-> download/
-> mme/
-> subpages/
-> temp/
-> siteadmin/
root: all 1st level file located there
images: all images. if images for subfolder, then another level there with the same name. upload is for uploaded images.
js: javascript
css: css
data: some raw data if needed
docs: word doc or pdf for download
download: something that for ppl to downlaod...
mme: other multimedia files. e.g. flash, movie.. soudn clips.etc.
subpages: 2 or subsequent level pages. organized in different folders
temp: any testing page store there. private, not public.
siteadmin: if you have an admin site.

I keep it simple, but then my web site doesn't need things that cause complexity. In general, each web page has a name that corresponds to a folder on disk and that folder contains all of the things needed to display that page. The hierarchy of the web site matches the hierarchy on disk.

It depends on the project but I generally go with js/, img/, and fl/. Sometimes I divide root into code/ and content/, but I think that may be overkill. As far as naming convention, I usually have my images perpended with the name of the page they are generally embedded on. If they are on every page, I go with something like global_ or all_. I hope that helps...

If there are many images then a folder for them is useful, however I tend to have 1 JS file, 1 or 2 CSS.
The most useful thing I think is to mod_rewrite all the pages, like stackoverflow does.

It really depends on how many pages your site has. Early on, it may seem like a good idea to simply drop all the pages in the root. Later on, when you have 120 unrelated files sitting there, you may start kicking yourself.
I tend to put together a simple 1-deep hierarchy, broken down by site area. /forums, /photos, /account, etc. I've learned from experience that your page count will tend to grow a lot higher than you anticipated. And I've learned from experience that it just plain sucks to move pages out of the root and into a sensible structure once they have external links. Best do it right from the start.

root
+-+ include
+-- cache
+-- script
+-- css
+-- images
This directory is of course not externally acessible.
Why all under include? Because none of these media files are served directly. They all go through a script that:
Compacts all the CSS files into one file;
Compacts all the Javascript into one minified file;
Writes those versions to the cache directory;
Timestamps css, js and image files and sets the expires header to far in the future;
Keeps cached copies of the compacted js and css files in the cache directory; and
All references to those files goes through an auto version function that uses the last modified time to change the URL to control when the client gets a new copy (eg /css/screen.1234567890.css), similar to what SO does with its query string on such files.
The above can speed up a site significantly.
The rest of the directory structure will mirror the menu structure of the site. If there is an "Orders" top level menu items with a submenu then you can bet you'll find an accounts directory under the root directory.
All this makes the site very, very predictable if someone else needs to come and maintain it. It's extremely important that someone else is able to find their way around.

Related

Copy and paste Typo3 Sites between 2 backends

I am managing around 12 TYPO3 backends with almost similar content. Is it possible to copy and paste a created site between independent backends? Right now I'm creating by hand 12 sites with the same content. There has to be an easier way.
Well, there is not much I could try. Within TYPO3 I don't see any option to export/import sites from other backends.
First of all you should merge those 12 sites into one backend with multiple root sites and trees. Then you can easily handle different domains and/or languages via the site configurations for those roots.
Of course you can then make use of shared sys_folder pages that contain the content elements, that should be available for multiple sites. To make them available for a specific site, you can use references then.
You can export a page tree and import it into another instance.
On the other hand you can duplicate an instance by copying the complete database and original files.
That includes necessarily the fileadmin/ and uploads/ folders.
typo3conf/ should be duplicated by deployment but might differ in the files typo3conf/LocalConfiguration.php and typo3conf/AdditionalConfiguration.php (e.g. each instance should have other databases).
You can use the core extension impexp to import/export content parts. There is even a context menu entry
Be aware of some drawbacks:
if assets are exported, those are exported & imported you can hit the limit of your memory_limit
take extra care about which uids should be used, e.g. forcing uids can lead to drawbacks
Of course there are other options as well like:
create a custom extension which exports/imports the content on the fly using either something like a custom endpoint or fetching directly the DB if possible
use 1 installation as discussed already
if e.g. using ext:news use something like rss feeds for a poor man import/export with ext:news_importicsxml

TYPO3 9+: Multiple user_uploads related to page tree

is it possible to use different user_uploads by page tree in TYPO3 9+?
Informations:
Multiple companies are using the same TYPO3 instance for their websites.
Example #1:
An editor is placing images in a content element on a page of a page tree with drag'n'drop. Normally the files would be uploaded to the user_upload folder. If you have a huge amount of backend editors the user_upload folder will be a mass in a short time and nobody feels responsible for the files. I know that you can see if a file is used by its references in the info section but it would be much easier if a company would have its own user_upload directory (maybe subfolder of it).
Did anyone faced the same problem an has a solution for this?
Thanks in advance!
I think you should configure your user groups and their users in such a way that they use the correct storage. you can read about it here:
https://docs.typo3.org/m/typo3/reference-tsconfig/master/en-us/UserTsconfig/Options.html#defaultuploadfolder
https://docs.typo3.org/m/typo3/reference-coreapi/master/en-us/ApiOverview/AccessControl/MoreAboutFileMounts/Index.html

Can I use symbolic links in Dokuwiki's page files?

I'm planning to try using dokuwiki to manage my large collection of notes, and one of the major attractions is its flat file basis that'll allow me to edit via scripts etc. I had a question - suppose a page's material fits into multiple namespaces. If I were to create the file in one namespace and then create symlinks in the other namespace directories, would that work? Or would that screw up revisions etc?
Yes, you can do that. But yes, this will mess with your revisions a bit:
when DokuWiki saves a page, it copies the data of the old page to the attic
the name of the attic file is the same as the page that was edited, but with a timestamp appended
because new attic files are created you can't work with symlinks in the attic
Imagine you have the following setup:
data/pages/original.txt
data/pages/copy.txt -> original.txt
You now can edit the pages original and copy in your wiki and they will both always be the same. However old revisions of the pages will be split between the two, depending on which page you edited.
Instead of messing with file level consider
Include plugin to share content between pages.
Creation of some 'commons' namespace for such pages to be DRY.
Namespace templates (+ additional plugin).
Pulling content from page side instead of pushing it to pages. This might be good to start with. You can always include some php code or even write your own plugin.

Presenting a website locally and offline in iOS

I am developing an application for a client where a requirement is that a series of complex (multi-file, JS, CSS, etc), websites must be presented offline, without any web connection required at all.
So I have all of the HTML content folders, and can add them into my XCode project... but now I need to show them.
The UIWebView is fine when you just have one HTML file... but the relative paths for the JS and CSS do not translate over.
What is the best way to do this. I've seen a couple of potential choices. One way is to run a super basic web server locally, dump all the files into /documents (or thereabouts) and serve it from there... the second is to somehow make UIWebView re-interpret the paths so that they point to the right place locally... which I am not sure if it's possible but I've seen it alluded to.
Seems like a lot of people just cover loading a single UIWebView page, and not so much discussing how to deal with CSS/JS dependencies.
Anyone have any bright ideas, links, etc?
Thanks
I think that if you add your HTML/CSS/JS tree to your Xcode project and select "Create folder references for any added folder" (instead of "Recursively create groups for any added folders"), then your bundle will contain the HTML/CSS/JS folder hierarchy (instead of the flattened-out list of all files). This would preserve relative paths.
As to the "reinterpreting" point, you can define
– webView:shouldStartLoadWithRequest:navigationType:
in your UIWebViewDelegate to intercept any attempt at loading any file. There you can change the url on the fly.
Also, have a look at this interesting article by Rob Napier: Drop-in offline caching for UIWebView.

DokuWiki with SVN: how and what should be under source control

I want to store my documentation under SVN source control.
In DokuWiki settings there is
Directory for saving data '.../apps/dokuwiki/data'
DokuWiki stores all data inside text files under '.../apps/dokuwiki/data' folder. There are many stuffs there including indexes caches etc. It seems that I only need the 'pages' folder.
How can I move the 'pages' folder inside my SVN folders and configure the DocuWiki to use pages from there?
$conf['datadir'] can be used in conf/local.php to set the page directory independently from the rest of the directories in data. You probably want to use $conf['mediadir] for uploaded images and files as well and maybe $conf['metadir'] for saving page metadata.
Here's an example of what I set mine to:
$conf['datadir'] = './my-data/pages/';
$conf['mediadir'] = './my-data/media/';
$conf['metadir'] = './my-data/meta/';
N.B. Be sure to use 'datadir' (not 'pagedir') as noted in the comments to the earlier answer.
You may also want to configure your attic:
$conf['olddir'] = './my-data/attic/';
This makes management under svn more complicated, as you have to add attic files all the time, but it preserves change history across developers. This depends a little more on your installation though; if you regularly clean your attic you wouldn't want to do this.