I have this code:
customers = CONTENT
customers {
table = tx_nmshowroom_customers
select {
pidInList = {$plugin.tx_nmshowroom_pi1.pid.showroomData}
recursive = 10
where = FIND_IN_SET(uid, ###CUSTOMERSLIST###)
markers {
CUSTOMERSLIST.field = tx_nmshowroom_customers
}
}
customersList = COA
customersList {
10 = HTML
10.value.field = name
10.value.typolink{
parameter = {$plugin.tx_nmshowroom_pi1.pid.customersDetailView}
additionalParams = &tx_nmshowroom_pi1[customeruid]={field:uid}
additionalParams.insertData = 1
}
10.stdWrap {
wrap = <p class='list'>|</p>
required = 1
}
}
renderObj < .customersList
renderObj.stdWrap {
wrap = <div class='label'><p>Auftrag:</p></div><div>|</div>
required = 1
}
}
The select can also return no value, that means that no record is found.
In this case I would like to replace the customers Object with a text or with another IMAGE.
The problem is, that I don't know how to write the condition on "customers":
customers.override.if..... No idea at all.
Can anybody help me?
Thank you very much in advance.
Davide
I would suggest this solution:
customers.stdWrap.ifEmpty = Sorry, there is no content here
Of if you need an content object:
customers.stdWrap.ifEmpty.cObject = TEXT
customers.stdWrap.ifEmpty.cObject.value = Sorry, there is no content here
customers = COA
customers {
10 = CONTENT
10 {
table = tx_nmshowroom_customers
select {
pidInList = {$plugin.tx_nmshowroom_pi1.pid.showroomData}
recursive = 10
where = FIND_IN_SET(uid, ###CUSTOMERSLIST###)
markers {
CUSTOMERSLIST.field = tx_nmshowroom_customers
}
}
renderObj = COA
renderObj {
10 = HTML
10 {
value.field = name
value.typolink{
parameter = {$plugin.tx_nmshowroom_pi1.pid.customersDetailView}
additionalParams = &tx_nmshowroom_pi1[customeruid]={field:uid}
additionalParams.insertData = 1
}
stdWrap {
wrap = <p class='list'>|</p>
required = 1
}
}
wrap = <div class='label'><p>Auftrag:</p></div><div>|</div>
required = 1
}
}
20 = TEXT
20 {
if.isFalse.numRows < customers.10
value = [substitute content]
}
}
Related
Currently, i've getting the string data from the maps.kml to display in laravel blade for simple testing. Based on the official documentation, mapbox can parse the kml string to maps. But it wont displayed.
Controller
...
$excelFile = public_path().'/assets/excel.xlsx';
$kmlfile = public_path(). '/assets/maps.kml';
$kmlContent = file_get_contents($kmlfile);
$kmlLoad = simplexml_load_string($kmlContent);
$kmlJsonFile = $kmlLoad->Document->Folder->Placemark;
// $kmlJson = json_decode($kmlLoad);
$parse = SimpleXLSX::parse($excelFile);
if ($parse) {
$petaSheet = $parse->rows(0, 0); //worksheet index, row limit
foreach($kmlJsonFile as $item)
{
foreach($petaSheet as $peta)
{
if($peta[0] == $item->name)
{
$item->Style->LineStyle->color = $peta[0];
}
}
}
// $monitorSheet = $parse->rows(1, 0);
} else {
$excelRaw = SimpleXLSX::parseError();
}
// $kmlJsonFile = json_encode($kmlJsonFile);
return view('home', [
'peta' => $petaSheet,
'kml' => $kmlContent
]);
Here the js file inside laravel blade
var kmlString = "";
kmlString += `{!! $kml !!}`;
var runLayer = omnivore.kml.parse(kmlString)
.on('ready', function() {
map.fitBounds(runLayer.getBounds());
})
.addTo(map);
I have a little code to traite and sort some data get by api, my probleme but actually is that's applying on first array, could you please help me to resolve my problem ?
downlinks = [];
for (var i = 0; i < msg.payload.length; i++) {
downlink = {};
downlink.eui = msg.payload[i].valve_EUI;
if (msg.payload[i].System_Activated === null ) {
downlink.payload = new Buffer("00", "hex");
} else {
downlink.payload = new Buffer( "01", "hex");
}
downlink.port = 1;
downlink.ack = true;
downlink.RxWnd = 1;
downlinks.push(downlink);
}
return downlinks;
This is a Trigger Warp code:
if (needEnter) {
if (keyboard_check(vk_enter)) {
audio_play_sound(door_open,0,0);
room_goto(targetRoom);
obj_player.x = targetX;
obj_player.y = targetY;
obj_player.image_index = playerSide
}
else {
if (!instance_exists(obj_msgballoon)) {
balloon = instance_create_layer(obj_player.x, obj_player.bbox_top, "hud", obj_msgballoon);
balloon.balloon_msg = msg_openable_door;
}
playerIsIn = true
}
}
else {
room_goto(targetRoom);
obj_player.x = targetX;
obj_player.y = targetY;
}
The code above triggers the spawn of the obj_msgballoon Instance normally... but something like this doesn't:
if (keyboard_check(vk_enter)) {
if instance_exists(obj_msgballoon) {
if (obj_msgballoon.image_yscale > 1) {
if cooldown < 1 {
instance_destroy(obj_msgballoon)
balloon = instance_create_layer(obj_player.x, obj_player.bbox_top, "hud", obj_msgballoon)
balloon.isTimed = true;
balloon.balloon_msg = msg_locked_door;
cooldown = 15;
}
}
cooldown--;
}
else {
balloon = instance_create_layer(obj_player.x, obj_player.bbox_top, "hud", obj_msgballoon)
balloon.isTimed = true;
balloon.balloon_msg = msg_locked_door;
}
if (!audio_is_playing(locked_door_snd)) {
audio_play_sound(locked_door_snd,0,0);
}
}
Even if I do something like this it does not work:
balloon = instance_create_layer(obj_player.x, obj_player.bbox_top, "hud", obj_msgballoon);
balloon.balloon_msg = msg_openable_door;
I just can't find out the problem... maybe I'm missing something?
Edit: Here it is the code of the obj_msgballoon;
STEP:
if (p) {
sprite_index = ballon_msg;
p = false;
}
if (!isTimed) {
if image_yscale < 1 {
image_yscale += 0.3
}
x = obj_player.x
y = obj_player.bbox_top - 15
} else {
if image_yscale < 1 {
image_yscale += 0.3
}
x = obj_player.x
y = obj_player.bbox_top - 15
if cooldown < 1 {
instance_destroy();
}
cooldown--;
}
CREATE:
image_yscale = 0
p = true;
cooldown = 40;
isTimed = false;
balloon_msg = pointer_null;
How can I parse the tumblr response in order to retrieve items such as the photo link, title etc. According to Tumblr API, it's in JSON format but I can't seem to understand how to code it. Here a snippet of the response:
{
"blog_name" = myBlogName;
"can_reply" = 0;
caption = "<p>pending again</p>";
date = "2014-01-19 15:54:22 GMT";
followed = 0;
format = html;
highlighted = ();
id = 73836876344;
"image_permalink" = "http://bantaybayan.tumblr.com/image/73836876344";
liked = 0;
"note_count" = 0;
photos = (
{
"alt_sizes" = (
{
height = 558;
url = "http://24.media.tumblr.com/f3fc43d081e3a6366e794b4f94a82d37/tumblr_mzno6mMXgr1tnzku0o1_1280.jpg";
width = 740;
},
{
height = 377;
url = "http://31.media.tumblr.com/f3fc43d081e3a6366e794b4f94a82d37/tumblr_mzno6mMXgr1tnzku0o1_500.jpg";
width = 500;
},
{
height = 302;
url = "http://24.media.tumblr.com/f3fc43d081e3a6366e794b4f94a82d37/tumblr_mzno6mMXgr1tnzku0o1_400.jpg";
width = 400;
},
{
height = 189;
url = "http://25.media.tumblr.com/f3fc43d081e3a6366e794b4f94a82d37/tumblr_mzno6mMXgr1tnzku0o1_250.jpg";
width = 250;
},
{
height = 75;
url = "http://31.media.tumblr.com/f3fc43d081e3a6366e794b4f94a82d37/tumblr_mzno6mMXgr1tnzku0o1_100.jpg";
width = 100;
},
{
height = 75;
url = "http://31.media.tumblr.com/f3fc43d081e3a6366e794b4f94a82d37/tumblr_mzno6mMXgr1tnzku0o1_75sq.jpg";
width = 75;
}
);
caption = "";
"original_size" = {
height = 558;
url = "http://24.media.tumblr.com/f3fc43d081e3a6366e794b4f94a82d37/tumblr_mzno6mMXgr1tnzku0o1_1280.jpg";
width = 740;
};
}
);
"post_url" = "http://bantaybayan.tumblr.com/post/73836876344/pending-again";
"reblog_key" = LUOtTeAe;
"short_url" = "http://tmblr.co/Z89Zxo14n1L8u";
slug = "pending-again";
state = published;
tags = (
);
timestamp = 1390146862;
type = photo;
}
Thanks in advance
First of all, this doesn't look like JSON. Check it with a validator like JSONLint
It's easier if you use an editor for JSON data. There a lots of free online services http://jsoneditoronline.org/
For Objective-C, this SO question might help you out: Parsing JSON using Objective-C
Is there any easier way of traversing array/dictionaries without creating a lot of separate NSArrays/NSDictionaries? I know you can traverse nested dictionaries with dot notation and value at keypath, but what about when arrays are involved?
For example:
At the moment if I want to get at the object at feed.entry.link[4].href in the API result below, I have to define an array at keypath "feed.entry", then assign its first entry as a dictionary, then define an array at keypath "link" and access its fourth entry as a dictionary, and then access its value at "href".
Is this normal?
received {
encoding = "UTF-8";
feed = {
entry = (
{
author = (
{
name = {
"$t" = swdestiny;
};
uri = {
"$t" = "https://gdata.youtube.com/feeds/api/users/swdestiny";
};
}
);
category = (
{
scheme = "http://schemas.google.com/g/2005#kind";
term = "http://gdata.youtube.com/schemas/2007#video";
},
{
label = Entertainment;
scheme = "http://gdata.youtube.com/schemas/2007/categories.cat";
term = Entertainment;
},
{
scheme = "http://gdata.youtube.com/schemas/2007/keywords.cat";
term = Star;
},
{
scheme = "http://gdata.youtube.com/schemas/2007/keywords.cat";
term = Wars;
},
{
scheme = "http://gdata.youtube.com/schemas/2007/keywords.cat";
term = Episode;
},
{
scheme = "http://gdata.youtube.com/schemas/2007/keywords.cat";
term = 3;
},
{
scheme = "http://gdata.youtube.com/schemas/2007/keywords.cat";
term = Revenge;
},
{
scheme = "http://gdata.youtube.com/schemas/2007/keywords.cat";
term = of;
},
{
scheme = "http://gdata.youtube.com/schemas/2007/keywords.cat";
term = the;
},
{
scheme = "http://gdata.youtube.com/schemas/2007/keywords.cat";
term = Sith;
}
);
content = {
"$t" = "sw-destiny.net Trailer for Revenge of the Sith";
type = text;
};
"gd$comments" = {
"gd$feedLink" = {
countHint = 1567;
href = "https://gdata.youtube.com/feeds/api/videos/9kdEsZH5ohc/comments";
rel = "http://gdata.youtube.com/schemas/2007#comments";
};
};
"gd$rating" = {
average = "4.7729683";
max = 5;
min = 1;
numRaters = 1132;
rel = "http://schemas.google.com/g/2005#overall";
};
id = {
"$t" = "http://gdata.youtube.com/feeds/api/videos/9kdEsZH5ohc";
};
link = (
{
href = "https://www.youtube.com/watch?v=9kdEsZH5ohc&feature=youtube_gdata";
rel = alternate;
type = "text/html";
},
{
href = "https://gdata.youtube.com/feeds/api/videos/9kdEsZH5ohc/responses";
rel = "http://gdata.youtube.com/schemas/2007#video.responses";
type = "application/atom+xml";
},
{
href = "https://gdata.youtube.com/feeds/api/videos/9kdEsZH5ohc/related";
rel = "http://gdata.youtube.com/schemas/2007#video.related";
type = "application/atom+xml";
},
{
href = "https://m.youtube.com/details?v=9kdEsZH5ohc";
rel = "http://gdata.youtube.com/schemas/2007#mobile";
type = "text/html";
},
{
href = "https://gdata.youtube.com/feeds/api/videos/9kdEsZH5ohc";
rel = self;
type = "application/atom+xml";
}
);
"media$group" = {
"media$category" = (
{
"$t" = Entertainment;
label = Entertainment;
scheme = "http://gdata.youtube.com/schemas/2007/categories.cat";
}
);
"media$content" = (
{
duration = 151;
expression = full;
isDefault = true;
medium = video;
type = "application/x-shockwave-flash";
url = "https://www.youtube.com/v/9kdEsZH5ohc?version=3&f=videos&app=youtube_gdata";
"yt$format" = 5;
},
{
duration = 151;
expression = full;
medium = video;
type = "video/3gpp";
url = "rtsp://v2.cache4.c.youtube.com/CiILENy73wIaGQkXovmRsURH9hMYDSANFEgGUgZ2aWRlb3MM/0/0/0/video.3gp";
"yt$format" = 1;
},
{
duration = 151;
expression = full;
medium = video;
type = "video/3gpp";
url = "rtsp://v2.cache5.c.youtube.com/CiILENy73wIaGQkXovmRsURH9hMYESARFEgGUgZ2aWRlb3MM/0/0/0/video.3gp";
"yt$format" = 6;
}
);
"media$description" = {
"$t" = "sw-destiny.net Trailer for Revenge of the Sith";
type = plain;
};
"media$keywords" = {
"$t" = "Star, Wars, Episode, 3, Revenge, of, the, Sith";
};
"media$player" = (
{
url = "https://www.youtube.com/watch?v=9kdEsZH5ohc&feature=youtube_gdata_player";
}
);
"media$thumbnail" = (
{
height = 360;
time = "00:01:15.500";
url = "http://i.ytimg.com/vi/9kdEsZH5ohc/0.jpg";
width = 480;
},
{
height = 90;
time = "00:00:37.750";
url = "http://i.ytimg.com/vi/9kdEsZH5ohc/1.jpg";
width = 120;
},
{
height = 90;
time = "00:01:15.500";
url = "http://i.ytimg.com/vi/9kdEsZH5ohc/2.jpg";
width = 120;
},
{
height = 90;
time = "00:01:53.250";
url = "http://i.ytimg.com/vi/9kdEsZH5ohc/3.jpg";
width = 120;
}
);
"media$title" = {
"$t" = "Star Wars Episode 3 Revenge of the Sith Trailer";
type = plain;
};
"yt$duration" = {
seconds = 151;
};
};
published = {
"$t" = "2007-05-23T03:31:54.000Z";
};
title = {
"$t" = "Star Wars Episode 3 Revenge of the Sith Trailer";
type = text;
};
updated = {
"$t" = "2012-02-20T17:14:37.000Z";
};
"yt$statistics" = {
favoriteCount = 763;
viewCount = 796719;
};
}
);
xmlns = "http://www.w3.org/2005/Atom";
"xmlns$gd" = "http://schemas.google.com/g/2005";
"xmlns$media" = "http://search.yahoo.com/mrss/";
"xmlns$yt" = "http://gdata.youtube.com/schemas/2007";
};
version = "1.0";
}