How to change the default title tag in Foundation 6? - zurb-foundation

The default title tag is <title>Foundation for Sites</title> after running terminal command npm start or npm run build.
Is it possible to have the title tag output <title>MY WEBSITE TITLE</title> instead?

It looks like you might be using the Basic Template. Utilize the Zurb Advanced Template instead. It's got nifty Handlebars templating and other goodies. And it's the one Zurb uses with their client work.
http://foundation.zurb.com/sites/docs/starter-projects.html
Once you download & extract the advanced template, open src\layout\default.htm. Update the title tag.
Zurb 6 uses Panini to generate the page. So you could separate out title to a {{ title }} variable.

Related

Combining Django Templates and Polymer

I've been stuck for the past few hours trying to figure out why the core Polymer elements are not being displayed properly in a Django application I'm making to act as a personal webpage. The application at the moment just points to an index.html page which, if you follow the tutorial on Polymer, is up to step one.
However, the components are not loading on my page. The static files are all set up correctly, and there's subtle animation from the css files being loaded correctly, but the Roboto font and the core-elements are not being displayed. Running the site as a normal HTML file does everything correctly.
Is there a specific way to user Polymer in a Django template?
Thanks.
See Eric's answer to this on the polymer-dev mailing list: https://groups.google.com/forum/?fromgroups=#!searchin/polymer-dev/django/polymer-dev/N2R8qknalOI/58ZhC1gWFh4J
Relevant excerpt:
Django 1.5 has support for the verbatim tag. You can wrap your inlined element definitions in that:
https://docs.djangoproject.com/en/1.5/ref/templates/builtins/#verbatim
Example code snippet:
{% verbatim %}
<template repeat="{{item as items}}">
<my-element name="{{item.name}}"></my-element>
</template>
{% endverbatim %}
<script>
document.querySelector("template').model = {{items}}; // items here is filled by the server's template.
</script>
I'm pretty sure this has to do with the fact that Django uses the same {{}} in its templates as Polymer.
I'm adding this answer as a compliment to the already accepted answer.
You can force django to require a space for it's template tags. So for any django template tags you have to use {{ variable }} and for polymer you will use {{variable}}.
Here is a very simple module/app I created to "prepare" django for use alongside polymer.
https://github.com/andrewebdev/django-ostinato/blob/2c435dea23319be6e9011e7381afca2b4092b5a2/ostinato/polyprep/init.py
Credit goes to https://github.com/nebrybledu for this suggestion.

Is it possible to nest plugins in django-cms 2?

I am trying to have nested plugins in Django-CMS, i.e. a plugin template which itself
contains placeholder tags which can be filled with content.
I tried the straightforward way of just putting the tags there and I can add content
via frontend editing, but when I save it, it never shows up.
Am I doing something wrong or is it just not supported?
I am using Django-CMS 2.4.3
Thanks in advance!
You actually have to 'render' the child plugins in the plugin template.
I am not sure if {% render_plugin %} is already inplemented in 2.4.... For best experience with nested plugins be sure to upgrade to 3.0

django-autocomplete-light links cannot target iframe

Sorry up front if my terminology will be non-standard, but I am new to Django and Python...I am using Python 2.7.3 and Django 1.4.3 on a Mac OSX 10.7 (Lion). Django-autocomplete-light version 1.1.7.
I am using the django-autocomplete-light module to create a page where I can search within a set of videos (hosted on an external source like Youtube). I defined a model / app called Videos that contains a set of videos hosted on this third-party site. At the top of my videos/index.html page, I have a search box that is powered by the django-autocomplete-light module. I have gotten the overall search function working--when I type something into the search box, the relevant videos are shown in the drop-down menu automatically. I want the clicked video to play within an embedded player on the page--for some reason, this keeps on loading the video into the entire, existing document / page instead of just the iFrame. In my structure for the search box, I included the "target" attribute already. My understanding is that including "target" should work, but I must be missing something. When I check Firebug, the "target" attribute is included in the link in the search results (sorry, can't post a screenshot of this since I don't have enough reputation points...but it's there. The iFrame also has its "name" attribute assigned to the same thing).
Side note--I am hosting the video on a private service (not Youtube), so I prefer not to use a library like jQuery TubePlayer...but the concept remains the same).
My questions--is there another way to do this? Am I missing something obvious? Does django-autocomplete-light not play nice with iFrames?
(templates/videos/index.html)
<iframe name="tvplayer" width="560" height="315" src="http://www.youtube.com/embed/CE0Q904gtMI" frameborder="0" allowfullscreen></iframe>
(navigation_autocomplete/autocomplete.html)--I understand that all videos will return the same link using this code, but I can't even get this one to work!
{% for video in videos %}
<a style="display:block" href="http://www.youtube.com/embed/3svKWr9LH4I" target="tvplayer">{{ video.title }} - {{ video.desc }}</a>
{% endfor %}
Thanks for your help!
Solved my own question...within the navigation_autocomplete/script.html page, you have to change the navigation_autocomplete javascript handler directly since it overrides any other styling / parameters that you put into the a tag.

How to correctly modify <HEAD> in Django-CMS for custom plugins?

Django-CMS custom plugins and navigation extenders allow to create any content HTML in some part of the HTML . However I frequently have some JavaScripts required for some specific plugins, like a photo album viewer plugin that requires a JS in the .
My current solution is to let the user specify a specific template for that. I could do some checking in the template render() to use a specific placeholder or use placeholder restrictions but that doesn't seem right: It's still in the "body" placeholder.
Any suggestion?
Nothing wrong with including Javascript in the body - in fact, some consider it best practice.

Issue embedding TinyMCE in Django: the TinyMCE app wouldn’t show up in the browser

I’m working on a web application with Django, and I’m using the Flatpages app.
Now, I’m trying to embed the TinyMCE WYSIWYG editor in Flatpages. I’m following the steps mentioned in the Apress book: Practical Django Projects. And I’ve done everything right, but the TinyMCE app wouldn’t show up in the browser. When I asked the Django IRC channel we found out that it’s not a Django problem, the problem seems to be with TinyMCE itself. When I tried to look up the documentation at the TinyMCE website, all I found was either very outdated, or totally unrelated to my problem. How should I go about this?
Have you tried django-tinymce?
I had the django app but have ditched it in favour of:
http://code.djangoproject.com/wiki/AddWYSIWYGEditor
The instructions were simple and easy to follow - especially the flatpage bit.
The only real issue I had was having to set MEDIA_URL as a relative value. Until I did that - all my pop-up windows for links and html etc were blank!
Author James Bennett has put up the source code for Second Edition of the book so you can either: check your code against that, or simply download and use his code.
However, there are two specific questions that you need to answer before further help:
which version of the book? (Second Edition covers Django 1.1, i.e. from trunk)
which version of Django are you using?
which version of python do you have (python -V)?
If you're using the Second Edition and have svn'd Django from trunk, I can help - I have it working fine. Here's my (OS X) setup (just for working through the Second Edition of the book with Django from trunk):
in settings.py:
TEMPLATE_DIRS = (
'/Users/[myhome]/Sites/django-templates/cms/',
)
in urls.py:
(r'^tiny_mce/(?P<path>.*)$', 'django.views.static.serve',
{ 'document_root': '/Users/[myhome]/djangocode/cms/jscripts/tiny_mce/' }),
Then there's the copy of change_form.html duplicated from the django directory and copied to:
/django-templates/cms/admin/flatpages/flatpage/
which includes:
{{ media }}
<script type="text/javascript" src="/tiny_mce/tiny_mce.js"></script>
<script type="text/javascript">
tinyMCE.init({
mode: "textareas",
theme: "simple" //or use advanced
});
</script>
{% endblock %}
Have a look through that and let us know how you get on!
I've been following the Practical Django Projects book myself. I got the TinyMCE embedded a few days ago as well. I can help, but I need a bit more info. Show me the line on the template where you include the TinyMCE javascript file. Also, describe where you placed the TinyMCE folder. I'm pretty sure your problem is that the script include reference doesn't match with the actual directory location.
A useful first check with JavaScript problems is to make sure all scripts are loaded. Take a look at the HTML source of the generated page in the browser, find all <script src="..."> tags and check that their paths are accessible.
You could also look at the terminal where you run the Django development server, or the "Net" tab of Firebug.
You can view the change_form.html code, which resides in my /[path to templates]/[project name]/admin/flatpages/flatpage/ and it works like a charm:
http://pastebin.com/f21a1cd97