Hi Im new to cms I was implementing djangocms in my project
I have already have my html files im added placholders in that for making that content editable for example:
{% block content %}
{% placeholder "content" %}
{% endblock content %}
I have added placeholder for all the places i needed when i come to menu i used placeholder it only changes in the current html page i need to change in all the page which have same header and footer
I Have tried
{% show_menu 0 100 100 100 %}
But it comes default cms menus i need menu with my template style.
I have also tried
{% include "header.html" %}
But the placeholder only coming the plugin i need to add link again and again in every page.
Is there any solution for while im adding plugin in header.html it will display on all the pages which have the same header ?
Related
I am trying to extend a navbar so it appears in several pages. When I insert {% extend %} {% block content %} {% endblock %}, it only appears as text - the code dosen't work.
Here is my Navbar that I want to extend:
This is how it appears in the browser:
This is the html file I want to include my navbar in:
How it appears:
I want to inherit my navbar, but only the code text appears in the browser.
{% extend %} and so on have no special meaning in HTML.
The syntax is clearly from some template engine. Maybe Nunjucks.
You'll need to pass your source code through the template engine and use the HTML generated from it.
I am new to web development and I am working on Django framework in VSCode. I have been trying to make a user interface for the web application which has a menu on the left side of the screen and a nav bar on top which says "home page" (the image is below). There I need all the texts and photos to be in the rest part of the page, and when I scroll down I want only that part to move, like in a real web application. But I don't know how to do it, do I have to use JavaScript for that or can I just do it within HTML/CSS?
As you can see in the picture the paragraph covers the nav bar.
Thank you!
What you're looking for is the CSS position: fixed property. For example:
<div class="navbar" style="position: fixed;">
https://www.w3schools.com/howto/howto_css_fixed_menu.asp
You must use a base_generic_page to contain all the aplication pages.
basic_generic_page has the nav_bar or side_bar
<html lang="en">
<head>
{% block title %}<title>Local Library</title>{% endblock %}
</head>
<body>
{% block sidebar %}<!-- insert default navigation text for every page -->{% endblock %}
{% block content %}<!-- default content text (typically empty) -->{% endblock %}
</body>
</html>
You can heritage the base in application pages and rewrite content block in this way :
{% extends "base_generic.html" %}
{% block content %}
<h1>Local Library Home</h1>
<p>Welcome to <em>LocalLibrary</em>, a very basic Django website developed as a tutorial example on the Mozilla Developer Network.</p>
{% endblock %}
Source: https://developer.mozilla.org/es/docs/Learn/Server-side/Django/Home_page
Much like the position:fixed
You could also give position: sticky
Has the added benefit of occupying space
Depend really on how you want the page to flow
I am currently a beginner in html and I have seen this problem many times and I do not know how to solve it. I copied a source code from a video in an attempt to make a social media. The following code is in the file home.html:
{% extends 'base.html' %}
{% block title %}
home
{% endblock title %}
{% block content %}
{{hello}}
<br>
{{user}}
{% endblock content %}
{% block scripts %}
<script>
$(document).ready(function(){
console.log('working')
})
</script>
{% endblock scripts %}
However, in the video the html page seems correct and all buttons and functions are working. On the other side my html page is like this:
...
The guide you have seen concerns Flask, a framework for applications written in Python. The code will not work because there is no preprocessor that can process it. In this case the browser will show you plain text without formatting.
I am trying to use tabbable divs in my django app. The toggle seem to work as expected, the content does show when the next tab is clicked.
But the CSS doesn't seem to be working. When I click on tab2, the focus still is in tab 1. On tab 2, it only grays out the button and when I click on other parts of the page the gray out disappears and even if tab2 details are shown, the focus is on tab 1.
Just to add here are my load scripts for the page
{% load bootstrap3 %}
{% bootstrap_css %}
{% bootstrap_javascript %}
On load of the page, I inspected the sources in chrome dev tools. In the sources section, I can see that jquery and bootstrap are loaded.
If your CSS is not working try collecting static files :
python manage.py collectstatic
I was able to make it work. I thought the libraries were not being loaded properly. In a way, because of the way the libraries are imported, they don't seem to work properly.
here's how it looks like at the top of my template
{% load static %}
{% load staticfiles %}
{% static 'static_jquery/js/jquery.js' %}
{% block content %}
{% load bootstrap3 %}
{% bootstrap_css %}
{% bootstrap_javascript %}
What it made work for me was that the bootstrap related libraries must be placed inside the block content. Before, it is placed up top after the load static statements.
And also I had to remove hardcoded script tags at the bottom of my template, then it worked. I had these removed
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
<script src="https://cdn.rawgit.com/twbs/bootstrap/v4-dev/dist/js/bootstrap.js"></script>
Other things that I did was install django_static_jquery, then performed collectstatic
I'm trying to build a static website using the GRAV CMS. So far, I've been creating *.html.twig files and associating a single page to the individual template.
This is how my pages look:
{% block header%}
{% include 'partials/bhss-default-header.html.twig' %}
{% endblock %}
#CONTENT
{% block footer%}
{% include 'partials/bhss-default-footer.html.twig' %}
{% endblock %}
However, my purpose is to have an editor creating pages from the admin interface and adding HTML blocks similar to the custom fields or shortcodes in WordPress. I want this blocks to be filled with text.
I need to mention that my website is built with Semantic-UI, so I'm not using any theme provided by GRAV.
How can I replicate this behavior and what choices do I have ? The website is small at this time, so I can remake every page.
Thank you!
If you want to use editor, you need to build your header and footer as Grav pages in Markdown, not Grav theme's template file in Twig. Example:
{% block header%}
{{ pages.find('/my-header').content }}
{% endblock %}
#CONTENT
{% block footer%}
{{ pages.find('/my-footer').content }}
{% endblock %}
my-header and my-footer are 2 pages. You can unpublish these pages to hide them from your menu and forbid direct access to them.