Firebug Lite selected html element - firebug-lite

How to get the selected element on the page with Firebug Lite?
I mean xPath or DOM-chain like in lower bar in WebInspector.
For example:
Html page
<html>
<head></head>
<body>
<div id="div_id">Text in div element</div>
</body>
</html>
After select div-element with Firebug Lite I want to get something like this: html->body->div#div_id

Related

How to save div elements in form post

I have a form currently with a text area.
However, I want it to have rich-text formatting (bold, bullet points etc..) and for that, I have found Quill, which is amazing.
I'm not sure how to get the contents of div id=editor and save that to the Django function, because it won't be part of the post, will it?
<link href="https://cdn.quilljs.com/1.3.6/quill.snow.css" rel="stylesheet">
<!-- Create the editor container -->
<div id="editor">
<p>Hello World!</p>
<p>Some initial <strong>bold</strong> text</p>
<p><br></p>
</div>
<!-- Include the Quill library -->
<script src="https://cdn.quilljs.com/1.3.6/quill.js"></script>
<!-- Initialize Quill editor -->
<script>
var quill = new Quill('#editor', {
theme: 'snow'
});
</script>

How I render content page to another html page

I have already base.html page. How I can get my specific contact page information into my home page with jinja
If I'm understating your question correctly, within your home.html you can use the include tag {% include 'contact.html' %} to have that bit of contact information be displayed directly in your home page from another template. For example:
Within your home.html
<body>
####
<!-- Home page information being displayed already -->
####
<!-- To include your contact page information -->
{% include 'contact.html' %}
</body>
Within your contact.html only the section where you have the contact information will be necessary and not the entire contact page, for example:
Instead of having
<!DOCTYPE html>
<html>
<head></head>
<body>
<section>
<!-- Other elements with the contact information -->
</section>
</body>
You will only use the section below within your `contact.html` file.
<section>
<!-- Other elements with the contact information -->
</section>

Is there a way to find and append a specific URL within HTML using Regex?

I have not been able to find in Stackoverflow advice on finding specific URLs and appending them. I am looking to create "deep links" using a popular affiliate network within HTML content. For example here is some HTML:
<h2>This is a title</h2>
<p>this is some text</p>
<p>link to macys</p>
<p>link to google</p>
<p>something else</p>
</body>
</html>
I want to use Regex to find just the Macys link (not the Google link) in the HTML and append the URLs with the "deep link" code from the affiliate network. So it looks like this:
<html>
<body>
<h2>This is a title</h2>
<p>this is some text</p>
<p>link to macys</p>
<p>link to google</p>
<p>something else</p>
</body>
</html>
I did a find and replace for http://macys.com, and www.macys.com, and http://www.macys.com and it works.

Umbraco "alttemplate=templatename" | Content Issue

I am using the "?alttemplate=TemplateName" on the end of my url within my umbraco xslt code
Here is the example: Click here
When a user clicks on the link a popup ( fancybox ) will trigger with the appropriate content rendering inside.
This pop up is working perfectly - the only issue is that the template associated to the node within umbraco has a RTE ( Rich Text Editor ). The content I input within the RTE is not displaying which is very weird because I have the umbraco field select item on the "CommunityVideo" template.
Theoretically the content should render but it's not.
Here is the code that populates the content:
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><umbraco:Item field="pageName" runat="server" /></title>
<link rel="stylesheet" href="/css/main.css" type="text/css" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"></script>
</head>
<body id="popup">
<div id="comm-video-wrap">
<umbraco:Item field="bodyText" runat="server" />
</div>
</body>
Any ideas?
There are a bunch of unlikely reasons.
Firstly you've spelled the alias wrongly on the item - I'm guessing that the name on the doctype is "Body Text" or "BodyText" or "bodyText" - all of which would generate an alias of bodyText - if not that could be the problem.
Secondly is there a stylesheet setting hiding the rendered item - use firebug to check that out.
Using the alttemplate should work - but you need to be sure its running the template that you think it is.
It could be that the is no usable text in the RTE which you can verify by adding the textIfEmpty attribute.
<umbraco:item field="bodyText" textIfEmpty="There is no commentary text" runat="server" />
There are other umbraco:item attributes that might help with debugging, try adjusting your umbraco:item statement to:
<umbraco:item field="bodyText" insertTextBefore="**BEFORE**" insertTextAfter="**AFTER**" htmlEncode="true" textIfEmpty="There is no commentary text" runat="server"/>
and if you can't see any text then the template you think is being run simply isn't.
Another possibility is that your Template name isn't exact (casing and all). Is fancybox doing an AJAX call to get the page? Is it getting the markup from above in the response or is it blank?

Extend base template in Smarty

Is it possible to extend a base template with another template in Smarty?
I know this is possible in Django using the {% entend %} tag. Is there an equivalent (or workaround) in Smarty?
Thanks
Although this question is a bit old, I thought that maybe someone looking for this information as of august 2011 would benefit to know that this can be done now with Smarty 3.
Example With Inheritance
layout.tpl
<html>
<head>
<title>{block name=title}Default Page Title{/block}</title>
</head>
<body>
{block name=body}{/block}
</body>
</html>
mypage.tpl
{extends file="layout.tpl"}
{block name=title}My Page Title{/block}
{block name=body}My HTML Page Body goes here{/block}
output of mypage.tpl
<html>
<head>
<title>My Page Title</title>
</head>
<body>
My HTML Page Body goes here
</body>
</html>
Taken verbatim from: http://www.smarty.net/inheritance
There is no build-in template inheritance in Smarty. But you can do similar thing with {include} and {capture}.
Your page template can look like:
{capture assign="context"}
<h2>Here is my page</h2>
{... some other smarty suff here ...}
{/capture}
{assign var="title" value="Just simple title text here"}
{include file="base.tpl"}
And base.tpl can look like following:
<html>
<title>{$title}</title>
<body>
{$context}
</body>
</html>