Hi,
I've got a bit of a noggin scratcher here. I've followed the code on the icanhaz website on how to do this, but nothing is working.
What I'm doing is loading in a json file (doesn't contain much, just some bits I want to plug into a web page), using icanhaz to do the replacements and generate the code and inserting it into the page.
From what I can see it's right. No JS errors reported, but then, nothing generated in my template.
Any help on this?
My html looks like this -
<script id="photos_user" type="text/html">
-
<img src="{{picture_thumbnail}}" alt="{{name}}" />
-
</script>
-
gallery.js is this -
$(document).ready(function () {
-
$.getJSON('json/gallery.json', function(data) {
-
doPictures(data, '#photos_user');
-
});
-
-
function doPictures(data, selector) {
-
$.each(data.photogallery, function(i,photogallery){
-
var image_data, photogallery;
-
image_data = {
-
picture_thumbnail: data.photogallery[i].src,
-
name: data.photogallery[i].name
-
}
-
photos_user = ich.photogallery(image_data);
-
$(selector).append(photographs);
-
});
-
}
-
});
-
and the json file -
{"photogallery": [
-
{
-
"src" : "images/DSC_0016-2.jpg"
-
"name" : "Thumbnail"
-
},
-
{
-
"src" : "images/DSC_0025-2.jpg"
-
"name" : "Thumbnail"
-
},
-
{
-
"src" : "images/DSC_0230-1.jpg"
-
"name" : "Thumbnail"
-
},
-
{
-
"src" : "images/DSC_0234.jpg"
-
"name" : "Thumbnail"
-
},
-
{
-
"src" : "images/DSC_0321-1.jpg"
-
"name" : "Thumbnail"
-
}
-
]
-
}
-
as I say - nothing out of the ordinary, but no code generated.
Any help here would be appreciated. It's driving me bonkers!
1 1292
Making progress, but it dies at the end...
HTML is still the same...
JS is now -
$(document).ready(function () {
-
$.getJSON('json/gallery.json', function(data) {
-
doPictures(data, '#photos_user');
-
});
-
-
function doPictures(data, selector) {
-
$.each(data.photogallery, function(i,photogallery){
-
var image_data, photogallery;
-
image_data = {
-
picture_thumbnail: data.photogallery[i].src,
-
name: data.photogallery[i].name
-
}
-
/*alert(image_data.picture_thumbnail); return false; works here/*
-
photos_user = ich.photogallery(image_data);
-
/*alert fails here*/
-
$(selector).append(photos_user);
-
});
-
}
-
});
-
The json file now has a comma between the different fields.
My testing shows that the code is falling over dead at the photos_user= line (as show with the comments).
Full html is this (incase it's me again!) -
<!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 content="text/html; charset=utf-8" http-equiv="Content-Type" />
-
<title>Slideshow</title>
-
<link rel="stylesheet" type="text/css" href="css/site-css.css" />
-
<link rel="stylesheet" href="css/gallery.css" type="text/css" media="screen" />
-
</head>
-
<body>
-
<div id="links-left">
-
<p>Links on the left</p>
-
</div>
-
<div id="links-right">
-
<p>Links on the right</p>
-
</div>
-
<div id="photos">
-
<script id="photos_user" type="text/html">
-
<img src="{{picture_thumbnail}}" alt="{{name}}" />
-
</script>
-
</div>
-
<div id="eoe">
-
<span>Slideshow designed by me</span>
-
</div>
-
<script src="js/jquery-1.5.1.min.js" type="text/javascript"></script>
-
<script src="js/ICanHaz.js" type="text/javascript"></script>
-
<script src="js/jquery.scrollTo.js" type="text/javascript"></script>
-
<script src="js/gallery.js" type="text/javascript"></script>
-
<script id="photographs" type="text/html">
-
-
</script>
-
-
</body>
-
</html>
-
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Nick Ellson |
last post by:
I have search and replace task and was hoping to get some advice. I
have a large text file of remote access users from Cisco's ACS
dumpfile that I need to batch alter 2000 of 3000 users. And...
|
by: strvariant |
last post by:
Our company contracted with an outside consultant over a year ago to
build a complex database application. The end product was put into
production over nine months ago.
Since then it has been...
|
by: pembed2003 |
last post by:
Hi all,
I need to write a function to search and replace part of a char*
passed in to the function. I came up with the following:
char* search_and_replace(char* source,char search,char*...
|
by: kids_pro |
last post by:
Hi there,
Is it possible to use RegEx.Replace to replace string like this.
string str = "The world heavy weight match";
I want to replace world = w and match = m
I can do that with 2 line of...
|
by: Peter Row |
last post by:
Hi,
I know this has been asked before, but reading the threads it is still not
entirely clear.
Deciding which .Replace( ) to use when.
Typically if I create a string in a loop I always use a...
| |
by: Charlie King |
last post by:
As I understand it, the use of FIR* to replace heading tags with
images in visually enabled CSS browsers is now frowned upon on the
basis that some screen readers will *nor* read back text that is...
|
by: David Van D |
last post by:
Hi there,
A few weeks until I begin my journey towards a degree in Computer
Science at Canterbury University in New Zealand,
Anyway the course tutors are going to be teaching us JAVA wth bluej...
|
by: Alan Silver |
last post by:
Hello,
MSDN (amongst other places) is full of helpful advice on ways to do data
access, but they all seem geared to wards enterprise applications. Maybe
I'm in a minority, but I don't have those...
|
by: Villanmac |
last post by:
Ahhhh, ive missed so many lessons this year that i have to try and teach myself c++ from a book and its so hard. Usually I just read this forums to pick things up but its doing my head in trying to...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...
| |