Page 1 of 1

Cant build multiple iframes for vex-modal in php

Posted: 29 Mar 2018, 17:35
by JanMolendijk
Dear admin i cant get the specivic id in my vex-modal script detected
i hope i can open multiply iframes in my script

Code: Select all

$sql = "SELECT * FROM `vpb_fetched_links_contents1` ORDER BY `id` DESC  LIMIT $limit OFFSET $offset   ";
try {
  $stmt = $DB->prepare($sql);
  $stmt->execute();
  $results = $stmt->fetchAll();
} catch (Exception $ex) {
  echo $ex->getMessage();
}
if (count($results) > 0) {
  foreach ($results as $res) {
    echo '
    
    <button id="vex_t1'. $res['id'] .'">See Reviews</button>
<script>
var win_cnt = "<iframe src=http://145.53.93.209/comments/user/Tip-Us/Review-Comments.php?notice_id='. $res['id'] .' width=100% height=100% frameborder=0 scrolling=yes align=top marginwidth=0 marginheight=0 name=offtopic></iframe>";     // Defines the content
vex.defaultOptions.className = "vex-theme-default";     // specifies the css theme

// sets a function to be called when we need it (receives the string content)
var vex_alert1 = function(content) {
  // calls the vex.dialog.alert() method to display the content
  vex.dialog.alert(content)
};

// registers click event to #vex_t1, to call the vex_alert1() function
$("body").on("click", "#vex_t1'. $res['id'] .'", function(){ vex_alert1(win_cnt); } );
</script>

Cant build multiple iframes for vex-modal in php

Posted: 30 Mar 2018, 05:03
by Admin
Try this in your script (i cant test it, so, if you get errors try to fix what you know and post errors here):

Code: Select all

foreach ($results as $res) {
  echo '<button id="vex_t1'. $res['id'] .'">See Reviews</button>
<script>
var win_cnt'. $res['id'] .' = "<iframe src=\'/comments/user/Tip-Us/Review-Comments.php?notice_id='. $res['id'] .'\' width=\'100%\' height=\'100%\' frameborder=\'0\' scrolling=\'yes\' align=\'top\' marginwidth=\'0\' marginheight=\'0\'></iframe>";

// registers click event to #vex_t1, to call the vex_alert1() function
$("body").on("click", "#vex_t1'. $res['id'] .'", function(){ vex_alert1(win_cnt'. $res['id'] .'); } );
</script>';
}

//this must be out of foreach
echo '<script>
vex.defaultOptions.className ="vex-theme-default"; // specifies the css theme

// sets a function to be called when we need it (receives the string content)
var vex_alert1 = function(content) {
  vex.dialog.alert(content)
};
</script>';