Umbraco "alttemplate=templatename" | Content Issue - xslt

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?

Related

How to add bootstrap scripts to django admin template?

I want to use some **Boostrap** elements into the **django admin** interface.
For that purpose, I have overided the *admin/base.html* template. I want to add the links to bootstrap javascripts (the two lines of code you have to put just before the `` in order to use bootstrap) into that template.
As it is out of any `{% block %}` in the original *admin/base.html*, is there a nice way to do that without copying the entire section ?
in your admin/base.html file add bootstrap style and js scripts using CDN as below;
<head>
<!-- Bootstrap CSS -->
<link href="https://cdn.jsdelivr.net/npm/bootstrap#5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
</head>
<body>
<script src="https://cdn.jsdelivr.net/npm/bootstrap#5.1.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p" crossorigin="anonymous"></script>
</body>
I hope this will help you as it works for me. Please try and if you have any queries related to this please add a comment.
Getting started with Bootstrap

My django blogging apps facebook share buttonposts wrong images

I currently have a blogging app hosted on heroku with a facebook share button. I googled read some post hear and other sites and came to the conclusion that I'm supposed to use meta tags in my head. So after running my url through the facebook url debugger and seeing these results
Inferred Property The 'og:image' property should be explicitly provided, even if a value can be inferred from other tags.
Inferred Property The 'og:url' property should be explicitly provided, even if a value can be inferred from other tags.
Inferred Property The 'og:title' property should be explicitly provided, even if a value can be inferred from other tags.
Inferred Property The 'og:image' property should be explicitly provided, even if a value can be inferred from other tags.
Share App ID Missing The 'fb:app_id' property should be explicitly provided, Specify the app ID so that stories shared to Facebook will be properly attributed to the app. Alternatively, app_id can be set in url when open the share dialog.
I did this
{% block fb_meta %}
<!- Search for these meta tags -->
<meta property="og:title" content="{{ post.title }}" />
<meta property="og:image" content="{{ post.image_url }}" />
<meta property="og:description" content="{{post.body}}">
<meta property="og:site_name" content="ysite"/>
<meta property="og:url" content="http:mysitedotcom{{ post.get_absolute_url }}" />
<meta property="og:type" content="article" />
<meta property="og:locale" content="en_US" />
<!-- Author info -->
<meta property="article:author" content="https://www.facebook.com/profile.php?id=100013675372228" />
<meta property="article:publisher" content="https://www.facebook.com/profile.php?id=100013675372228" />
<!-- End -->
{% endblock fb_meta %}
on my detail page and this in my head
{% block fb_meta %}
{% endblock fb_meta %}
It still does not work and shows the wrong pic, even after I deleted it. And when I check my console everything shows in the tags
like this
What is my issue? thanks for all help
EDIT this is the out put when I enter a url at facebook debugger
another question does order matter?
the following has been working for me. I have been fetching new scrape information which has the effect of updating the pic and for others who mayneed this info in the future the following is from the face book docs
Pre-cache the image with the URL Debugger
Run the URL through the URL debugger to pre-fetch metadata for the page. You should also do this if you update the image for a piece of content.
Use og:image:width and og:image:height Open Graph tags
Using these tags will specify the image to the crawler so that it can render it immediately without having to asynchronously.

HTML Page to PDF Issues

The project I have is to create a Vista Print like application. I have created a very basic interface that places a resizable div in an area that can be dragged around. I am also able to place text into this div via pop-up iframe with designmode. I then write this to a database.
I then call this data and create a pdf using Coldfusions cfdocument.
The issue is when the PDF is created the font looks slightly thicker and the word wrap is different than the html page interface which is very important. Note: The word wraps are determined by the divs height and width. It looks fine on the cfdocument process page it is just off when the pdf is created. Anyone have any ideas on this or can point me to some info that could help?
Thanks in advance.
Code Here:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<cfset webRes = "96">
<cfset pxlWidth = "921">
<cfset pxlHeight = "1178">
<cfset inWidth = (pxlWidth/webres)>
<cfset inHeight = (pxlHeight/webres)>
<cfquery name="qTextData" datasource="ds">
SELECT DocID, TextID, Width, Height, PosX, PosY, FontFamily, FontColor, FontSize, TextValue
FROM TextEditor
WHERE ((DocID = #session.docid#))
</cfquery>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Create PDF</title>
</head>
<cfoutput>
<cfdocument filename="mypdf.pdf" name="mypdf" fontembed="yes" format="pdf" overwrite="yes" pageheight="#inHeight#" pagewidth="#inWidth#" pagetype="custom">
<cfdocumentsection margintop="0" marginright="0" marginbottom="0" marginleft="0">
<body align="center" marginheight="0" marginwidth="0">
<div id="pageContainer" style="background-image:url(resources/image.caspx.jpg); background-repeat:no-repeat; height:#pxlHeight#px; width:#pxlWidth#px;">
<cfloop query="qTextData">
<div id="divTextField_#TextID#" style="position:absolute; top:#PosY#px; left:#PosX#px; width:#width#px; height:#Height#px; color:#FontColor#; font-family:#FontFamily#; font-size:#FontSize#pt; vertical-align:text-top; line-spacing:normal;">
#TextValue#
</div>
</cfloop>
</div>
</body>
</cfdocumentsection>
</cfdocument>
</cfoutput>
<script type="text/javascript">
window.open('http://linktopdf/mypdf.pdf','newWin','resizable=1');
</script>
</html>
I tried making this a comment but I started getting long winded and it was too large so it may not be the "answer" but if nothing else I'm sure it will have some helpful information in it.
What % are you viewing at and have you tried printing it out?
I've noticed that things can look lopsided or bigger than usual because they are just rendered weird in acrobat (or your PDF viewer of choice). Try adjusting the zoom and see if the display changes, also see if it prints correctly.
I have also found that like James suggested, I need special css just for the document. The CSS could be as odd as making one side of the div have a 1px larger border to make it look correct. Also keep in mind that although you view PDFs on the screen it is still a "print" media. PT means 1/72 of an inch which will look bigger when you scale from your 19+ inch monitor (which is further effected by your pixel resolution) to an 8.5" x 11" piece of paper that doesn't truly know what a pixel is. You may need to try adjusting your font size on the fly, something like: font-size: #fontSize-2#pt;. Change -2 to anything that may work for your output. You could also try using a unit that scales, like em.
The cfdocument docs list all the CSS that is supported as well as identify some restrictions. It does not appear that line-spacing:normal; is supported. Also make sure all your CSS is included inline or in a style tag but avoid using a linked .css file. I see you're doing that, just adding tips and pointers.
Also, according to the docs:
ColdFusion does not return HTML and CFML outside of
the <cfdocument></cfdocument> pair.
That means ColdFusion is processing your cfset statements but it does not return
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Create PDF</title>
</head>
and
<script type="text/javascript">
window.open('http://linktopdf/mypdf.pdf','newWin','resizable=1');
</script>
</html>
So it is possible that iText isn't rendering it as you would expect because
It does not have a doctype
It is an ill-formed HTML document

vBulletin Facebook LIKEs thumbnail

I'm running vBulletin 4.1.5 and I have configured it's Facebook settings. The problem I'm facing is when someone clicked LIKE button, the thumbnail posted in Facebook is not the first image in the thread, it will pick randomly from anywhere in the page i.e. avatar of any user replied in that thread!
Appreciate your help!
one solution is that you can define a global "facebook-thumbnail" for all shares.
Go to
AdminCP
Settings
Options
Facebook Options
Image URL
This image should be your site-logo or something else.
I'm still programming with vB3.8.x, however I'm working on a plugin for facebook liking. Might help you write you're own for vB4.x
First, you need opengraph and facebook namespaces defined:
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:og="http://opengraphprotocol.org/schema/" xmlns:fb="http://www.facebook.com/2008/fbml">
<head profile="http://gmpg.org/xfn/11">
Second, you need facebook's javascript:
<scr ipt type="text/javascript" src="http://connect.facebook.net/en_US/all.js#xfbml=1">
</scr ipt>
Last, you need open graph tags defined in the section of the html page:
<meta property="og:type" content="article" />
<meta property="og:title" content="this shows up as article's title when you like" />
<link rel="image_src" href="http://www.yoursite.com/yoursite1.jpg" />
<meta property="og:image" content="http://www.yoursite.com/yoursite1.jpg" />
<link rel="image_src" href="http://www.yoursite.com/yoursite2.jpg" />
<meta property="og:image" content="http://www.yoursite.com/yoursite2.jpg" />
<link rel="image_src" href="http://www.yoursite.com/yoursite3.jpg" />
<meta property="og:image" content="http://www.yoursite.com/yoursite3.jpg" />
<link rel="image_src" href="http://www.yoursite.com/yoursite4.jpg" />
<meta property="og:image" content="http://www.yoursite.com/yoursite4.jpg" />
The plugin I'm working on will loop through the top 5 attachments for a post and write out image_src tags and og:image tags. Not yet sure which hook I'll use.
pseudo code:
$attachs = $db->query_read_slave("
SELECT attachmentid, attachment.dateline
FROM " . TABLE_PREFIX . "post AS post
INNER JOIN " . TABLE_PREFIX . "attachment AS attachment ON (attachment.postid=post.postid AND attachment.visible=1)
WHERE threadid = $threadinfo[threadid]
AND post.visible = 1
ORDER BY filename DESC
LIMIT 5
");
if ($db->num_rows($attachs))
{
while ($attachment = $db->fetch_array($attachs))
{
$strImages = "<meta property=\"og:image\" content=\"/attachment.php?attachmentid=$attachment[attachmentid]&d=$attachment[dateline]\" />"
}
}
FYI - facebook seems to add thumbnails in a reverse manner. They'll look at the last og:image and use that as the first thumbnail; the next thumbnail shown would be the second to last and so on. Might want to play with the sort order of the SQL if that's important. Also, the image_src link is used for non-open graph social sites (google plus, twitter)

How to prevent Coldfusion from injecting cfform.js into the head section?

An HTML template is passed to Coldfusion. The head tag of the template has additional attribute:
<head profile="http://abc.com">
The issue is that when generating the output based on this template Coldfusion injects its scripts inside the head tag:
<head <script type="text/javascript" src="/CFIDE/scripts/cfform.js"></script>
<script type="text/javascript" src="/CFIDE/scripts/masks.js"></script>
profile="http://abc.com">
This causes profile="http://abc.com"> to appear on the top of the page and prevents page from validation.
The code injection occurs only when there is a form tag. The wrong-place injection does not happen if the head tag does not have any attributes. The presence of the attribute is a project requirement and cannot be omitted.
Is it possible to prevent Coldfusion from injecting the scripts?
The script injection only happens for cfforms, not standard forms. If you aren't using any of cfform's enhancements, you can simply switch to a standard form.
I checked the cumulative hotfix list, and didn't see a fix for this.
My Solution: Put the meta tag right after the
<html>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<head>
when CF creates the page it puts the tag below the but above the tags
<!DOCTYPE html>
<html class=" ext-strict">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<script type="text/javascript">/* <![CDATA[ */_cf_loadingtexthtml="<img alt=' ' src='/CFIDE/scripts/ajax/resources/cf/images/loading.gif'/>";
_cf_contextpath="";
_cf_ajaxscriptsrc="/CFIDE/scripts/ajax";
_cf_jsonprefix='//';
_cf_clientid='9851DA49BD375D9722A9D6B1951976AC';/* ]]> */</script><<script type="text/javascript" src="/CFIDE/scripts/ajax/yui/yahoo-dom-event/yahoo-dom-event.js"></script>