trying to clarify..
first i have this page, where different resources get pulled into the site with cardTpl chunk:
http://fuchs.raumanstalt.ch/index.php?id=2
this is the call:
[[!getResources? &parents`[[*id]]` &processTVs=`1` &tpl=`cardTpl` &includeTVs=`1`]]
the Tpl is:
<div class="entry" id="[[+tv.Projektnummer]]" >
<div class="wrapper">
<div class="entry_title">
<p>[[+tv.projectName]]</p>
</div>
<div class="entry_image"> [[+tv.projectCardImg]]</div>
</div>
</div>
the result are different "cards", which hold the teaser for a project. the div id’s are generated by modx dynamically based on the tv "Projektnummer".
when an entry is clicked, i want to have the js-effect before changing page, so i have to call the new page via js, which is done like this:
$("#overview").find(".entry").click(function() {//add function on click for every div with class "entry"
var clickedid=$(this);
$("#overview").find(".entry").each(function(e){//fade all cards except the clicked one
if($(this)!=clickedid){
$(this).animate({opacity: "0"}, "slow");
}
});//end each
var entry_pos=$(this).offset();//get the position of the card
createCookie("paletteX",entry_pos["left"]);//store position in cookie
createCookie("paletteY",entry_pos["top"]);
createCookie("bgimgstore",$("#bgimg").attr("src"));//store displayed background image in cookie
createCookie("currentId", clickedid);//store current project id in cookie (maybe useful later)
var nexturlphp="index.php?id=14&P="+$(this).attr("id");//the project page has modx-id 14. concatenate with parameter p for project, which comes from the div id (from modx)
$($(this).children()).fadeOut("slow");fade //fade the content of the clicked div
setTimeout(location.href=nexturlphp,500);//after a short while (fading takes a little), redirect to the project page with parameter P, which is the projectnumber
});
$("#page").find(".entry").each(function(e){//on dom ready, set all cards to visible again.
$(this).css("opacity","1");
});
so i end up with the browser calling the page:
http://fuchs.raumanstalt.ch/index.php?id=14&P=108
the project page should now be able to take the value of P with the following snippet and store it in $project, then echo to my code:
the snippet:
<?php
$project='';
$project = $_GET['P'];
echo $project;
?>
NOW,
i want to call getResources to fill in the content for the clicked Project. So i would have to look through all the project entries to see which one has the same TV "Projektnummer" as the $project variable.
and then fill the found contents into the infoTpl chunk:
<div class="projectnav_content">
<h2>[[+tv.projectName]]</h2>
<br />
<p>[[+tv.projectTxt]]</p>
</div>
as for now, the call looks like this:
[[!getResources? &parents=`[[~2]] &processTVs=`1` &includeTVs=`1` &where=`{"tv.Projektnummer:LIKE":"[[getProjektnummer]]"}` &tpl=`infoTpl`]]
but i’m very sure, there’s something wrong with that
hope i could explain a bit better..