dimanche 12 mars 2017

'ticked' checkboxes based on criteria

i am seeking for help in having ONLY checkboxes ‘checked’ for ‘unable to find character’ echo. I suspect its some if/else kind of statement, but after several times of trial and error, I ended up have all checkboxes checked (which is not correct). So I am reaching out to experts here for your kind guidance. Attached what I suspect as relevant original lines below for any expert’s advice, thank you very much:

echo '<tr>';
echo '<th valign="top" class="label" scope="row">';
echo '<input type="checkbox" class="chkLink alignleft">';
echo '<span class="alignleft"><label for="cartoon">';
_e('Source URL', 'cartoon');
echo '</label></span>';
echo '<span class="alignright"><abbr class="required" title="required">*</abbr></span>';
echo '</th>';

function cartoon_we_fetch_names_callback() {
$url = CARTOON_EMBED_IMP_UTILITIES::globalRequest('cartoon_we_url');

$html = cartoon_file_get_html($url);

if(!$html) {
echo '<div class="error notice-error notice-alt">Unable to find      Character</div>';
wp_die();
}


$names = $html->find('#names > ul', 0);

if(!$names) {
echo '<div class="error notice-error notice-alt">Unable to find Character</div>';
wp_die();
 }

 foreach ($names->find('.namesnumber') as $e) {
$e->outertext = '<input type="checkbox">' . $e->outertext;
}

foreach($names->find('a') as $link){
if($link->href) {
    $id = split('#', $link->href);
    $id = $id[1];
    $link->href = 'javascript:void(0);';
    $link->outertext = $link->innertext;
    $link->dataTarget = $id;
    $link->parent()->datatarget = $id;
}
}




Aucun commentaire:

Enregistrer un commentaire