I have this little issue with the price form for my Joomla backend.
The default value is always "nothing", so I just need to set "Euro" as default (see screenshot).
I'm pretty newbie with PHP, so I can't do it by myself..
Here is the part of code that realizes this form:
$htmlPrice = '<div class="jomcomdevPriceRow">';
$htmlPrice .= '<div class="control-group" style="float: left; margin-right: 10px;">';
$htmlPrice .= '<label> '.JText::_('COM_JOMCOMDEV_FIELD_PRICE_NETTO').'</label><input type="text" name="' . $this->name.'[price_netto][]" id="' . $this->id . 'ValueNetto"' . ' value="" />';
$htmlPrice .= '</div>';
$htmlPrice .= '<div class="control-group" style="float: left; margin-right: 10px;">';
$htmlPrice .= str_replace("\n", '', '<label is="jform_featured-lbl"> '.JText::_('COM_JOMCOMDEV_FIELDSET_PRICE_GROUP').'</label>'.JHtml::_('select.genericlist', JHtml::_('jdcategory.options', 'com_jomestate.price', array('onlyroot' => 0)), $this->name.'[type_id][]',"", 'value', 'text', null, true));
$htmlPrice .= '</div>';
$htmlPrice .= '</div>';
I hope I'm clear enough. Thank you in advance.
Screenshot:
http://i.stack.imgur.com/2Ix39.png
UPDATE
Hmm, I don't know really where is configured this element. Here is full code, maybe I'm looking a wrong part..
defined( '_JEXEC' ) or die( 'Restricted access' );
class JFormFieldJdPrice extends JFormField
{
/**
* #var string The form field type.
* #since 11.1
*/
public $type = 'JdAddress';
/**
* Method to get the field input markup.
*
* #return string The field input markup.
*
* #since 11.1
*/
public function getInput()
{
$id = JRequest::getInt('id');
// if(empty($id)) {
// $html = '<div style="padding: 10px; margin: 10px 0;">';
// $html .= JText::_('COM_JOMCOMDEV_PRICEADD_NOID_INFO');
// $html .= '</div>';
// return $html;
// }
$htmlPrice = '<div class="jomcomdevPriceRow">';
$htmlPrice .= '<div class="control-group" style="float: left; margin-right: 10px;">';
$htmlPrice .= '<label> '.JText::_('COM_JOMCOMDEV_FIELD_PRICE_NETTO').'</label><input type="text" name="' . $this->name.'[price_netto][]" id="' . $this->id . 'ValueNetto"' . ' value="" />';
$htmlPrice .= '</div>';
$htmlPrice .= '<div class="control-group" style="float: left; margin-right: 10px;">';
$htmlPrice .= str_replace("\n", '', '<label is="jform_featured-lbl"> '.JText::_('COM_JOMCOMDEV_FIELDSET_PRICE_GROUP').'</label>'.JHtml::_('select.genericlist', JHtml::_('jdcategory.options', 'com_jomestate.price', array('onlyroot' => 0)), $this->name.'[type_id][]',"", 'value', 'text', null, true));
$htmlPrice .= '</div>';
$htmlPrice .= '</div>';
$link = JURI::root()."index.php?option=com_jomcomdev&format=raw&task=ajax.price&name=first&id=";
$runScript = "
window.addEvent('domready', function() {
var options = {htmlPrice: '".$htmlPrice."', link: '".$link."', selector: $$('#".$this->id."')};
Comdev.price.init(options);
});
";
$document = JFactory::getDocument();
$document->addScriptDeclaration($runScript);
JText::script('COM_JOMCOMDEV_JS_BUTTON_ADD');
JText::script('COM_JOMCOMDEV_JS_BUTTON_DELETE');
JText::script('COM_JOMCOMDEV_JS_BUTTON_OPTION');
JText::script('COM_JOMCOMDEV_FIELD_PRICE_NETTO');
$html = '';
$html .= '<div id="'.$this->id.'">';
if(!empty($id)) {
$data = Main_Price::get($id, (string) $this->element['extension']);
foreach($data AS $d) {
$html .= '<div class="jomcomdevPriceRow">';
$html .= '<div class="control-group" style="float: left; margin-right: 10px;">';
$html .= '<label is="jform_featured-lbl"> '.JText::_('COM_JOMCOMDEV_FIELD_PRICE_NETTO').'</label><input type="text" name="' . $this->name.'[price_netto][]" id="' . $this->id . 'ValueNetto"' . ' value="'.$d->price_netto.'" />';
$html .= '</div>';
$html .= '<div class="control-group" style="float: left; margin-right: 10px;">';
$html .= '<label is="jform_featured-lbl"> '.JText::_('COM_JOMCOMDEV_FIELDSET_PRICE_GROUP').'</label>'.JHtml::_('select.genericlist', JHtml::_('jdcategory.options', 'com_jomestate.price', array('onlyroot' => 0)), $this->name.'[type_id][]', 'value', null, 'text', $d->type_id, true);
$html .= '</div>';
$html .= '<div class="control-group" style="padding-top: 17px;">';
$html .= '<label></label>'.JText::_('COM_JOMCOMDEV_JS_BUTTON_DELETE').'';
$html .= '</div>';
$html .= '</div>';
$html .= '<div class="clr"></div>';
}
}
$html .= '</div>';
return $html;
}
}
Related
in this php code i have foreach loop create textarea with checkbox for each statement
i wanna to enable textarea if his checkbox is checked
but they have same id
<?php
foreach($Arows as $row){
echo '<tr class="row">
<th class="col-sm-12"><h4>'.$row['Type_A'].'</h4></th>
</tr>';
$stmt3 = $con->prepare("SELECT * FROM sous_analyse WHERE Id_A =".$row['Id_A']);
$stmt3->execute();
$SArows = $stmt3->fetchAll();//Analyse rows
foreach($SArows as $Srow){
echo '<tr class="row">
<td class="col-sm-4">'.$Srow['Parameter'].'</td>
<td class=" col-sm-5"><input type="text" class="form-control col-xl-12 border-secondary" name="Fonctionnalite" placeholder="RESULTATS" required=""></td>
<td class="col-sm-3 text-center">'.$Srow['Normal'].'</td>
</tr>';
}
echo '<tr class="row">
<th class="col-sm-12">
<div class="input-group">
<span class="input-group-addon form-check">
<span class="checkbox-custom checkbox-default">
<input type="checkbox" class="icheckbox-grey" id="inputUnchecked" name="inputUnchecked">
<label for="inputUnchecked"></label>
</span>
</span>
<textarea class="form-control" id="textareaDefault" rows="3" style="margin-top: 0px; margin-bottom: 0px; height: 60px;" disabled></textarea>
</div>
</th>
</tr>';
}
?>
i use this script but is working in first textarea
<script >
$(document).ready(function() {
$("#inputUnchecked").on('click', function() {
if($(this).is(':checked')){
$("#textareaDefault").prop('disabled',false);
} else {
$("#textareaDefault").prop('disabled',true);
}
alert("fdg");
})
});
</script>
Expanding on my comment, you will want to adjust your PHP. This is easily done with a counter ($c).
<?php
foreach($Arows as $row){
$html = "";
$html .= '<tr class="row">'."\r\n";
$html .= '<th class="col-sm-12"><h4>'.$row['Type_A'].'</h4></th>'."\r\n";
$html .= '</tr>'."\r\n";
$stmt3 = $con->prepare("SELECT * FROM sous_analyse WHERE Id_A =".$row['Id_A']);
$stmt3->execute();
$SArows = $stmt3->fetchAll();
$c = 1;
foreach($SArows as $Srow){
$html .= '<tr class="row">'."\r\n";
$html .= '<td class="col-sm-4">'.$Srow['Parameter'].'</td>';
$html .= '<td class=" col-sm-5"><input type="text" class="form-control col-xl-12 border-secondary" name="Fonctionnalite" placeholder="RESULTATS" required=""></td>';
$html .= '<td class="col-sm-3 text-center">'.$Srow['Normal'].'</td>';
$html .= '</tr>';
}
$html .= '<tr class="row">';
$html .= '<th class="col-sm-12">';
$html .= '<div class="input-group">';
$html .= '<span class="input-group-addon form-check">';
$html .= '<span class="checkbox-custom checkbox-default">';
$html .= '<input type="checkbox" class="icheckbox-grey" id="inputUnchecked-$c" name="inputUnchecked">';
$html .= '<label for="inputUnchecked-$c"></label>';
$html .= '</span></span>';
$html .= '<textarea class="form-control" id="textareaDefault-$c" rows="3" style="margin-top: 0px; margin-bottom: 0px; height: 60px;" disabled></textarea>';
$html .= '</div></th></tr>';
echo $html;
$c++;
}
?>
Your JavaScript can then use the ID since it is unique or can simply be relative to nearby elements.
$(function() {
$("[id^='inputUnchecked-']").on('click', function() {
if($(this).is(':checked')){
$(this).parent().parent().find("[id^='textareaDefault-']").prop('disabled',false);
} else {
$(this).parent().parent().find("[id^='textareaDefault-']").prop('disabled',true);
}
alert("fdg");
})
});
I have developped this class and include inside my page but the return is always false. It seems the value $_POST of the recaptcha is not inserted process page.
Can you look ?
Thank
my class:
namespace Sites\Shop;
use Core\Registry;
use Core\HTML;
class GoogleRecaptcha {
const API = 'https://www.google.com/recaptcha/';
const SECRET_KEY = MODULES_CONTACT_US_GOOGLE_RECAPTCHA_SECRET_KEY;
const SITE_KEY = MODULES_CONTACT_US_GOOGLE_RECAPTCHA_SITE_KEY;
public function script() {
$Template = Registry::get('Template');
$footer ='<!-- contact_us google captcha end -->' . "\n";
$footer .= '<script src="' . self::API . 'api.js" async defer></script>' . "\n";
$footer .='<!-- contact_us google captcha end -->' . "\n";
return Template->addBlock($footer, 'footer_scripts');;
}
public function html($includeNoScript = false) {
$return = '<div class="g-recaptcha" data-sitekey="' . self::SITE_KEY . '"></div>';
if($includeNoScript == true) {
$return .= $this->noScript();
}
). "\n";
return $return;
}
private function noScript() {
$output = '<noscript>';
$output .= '<div style="width: 302px; height: 352px;">';
$output .='<div style="width: 302px; height: 352px; position: relative;">';
$output .= '<div style="width: 302px; height: 352px; position: absolute;">';
$output .= '<iframe src="' . self::API . 'api/fallback?k=' . self::SITE_KEY . '" frameborder="0" scrolling="no" style="width: 302px; height:352px; border-style: none;"></iframe>';
$output .= '</div>';
$output .= '<div style="width: 250px; height: 80px; position: absolute; border-style: none; bottom: 21px; left: 25px; margin: 0px; padding: 0px; right: 25px;">';
$output .= HTML::textAreaField('g-recaptcha-response','', '250px', '80px', 'id="g-recaptcha-response" class="g-recaptcha-response" style="border: 1px solid #c1c1c1; margin: 0px; padding: 0px; resize: none;"');
$output .= '</div>';
$output .= '</div>';
$output .= '</div>';
$output .= '</noscript>';
return $output;
}
public function check($response) {
$url = self::API . 'api/siteverify?secret=' . self::SECRET_KEY . '&response=' . $response . '&remoteip=' . $_SERVER['REMOTE_ADDR'];
$response = file_get_contents($url);
if($response->success===true) {
return true;
} else {
return false;
}
}
public function display() {
$output = '<!-- contact_us secret google captcha start -->'. "\n";
$output .= $this->script();
$output .= $this->html(true);
return $output;
}
}
my html page (simplified)
<?php
$GoogleRecaptcha = Registry::get('GoogleRecaptcha');
$contact_us_form .= $form;
$contact_us_form .= $OSCOM_GoogleRecaptcha->display();
$contact_us_form .= HTML::button(IMAGE_BUTTON_CONTINUE, null, null, 'primary', null, null, null, 'submit');
$contact_us_form .= $endform;
?>
result of my htmlpage
<form name="contact" action="http://boutique/index.php?Info&Contact&Process&action=process" method="post" id="contact"><input type="hidden" name="formid" value="a1e5d99fc7361f2c4ed4169a2ff6ae8b" />
<!-- contact_us secret google captcha start -->
<div class="g-recaptcha" data-sitekey=".................."></div>
<button id=submit type="submit" class="btn btn-primary">Continuer</button>
</form>
<!-- contact_us google captcha end -->
<script src="https://www.google.com/recaptcha/api.js" async defer></script>
<!-- contact_us google captcha end -->
<!-- contact_us_form end -->
my process (simplified)
if (isset($_GET['action']) && ($_GET['action'] == 'process') && isset($_POST['formid']) && ($_POST['formid'] == $_SESSION['sessiontoken'])) {
$error = false;
$google_captcha = HTML::sanitize($_POST['g-recaptcha-response']);
var_dump($google_captcha);
var_dump($OSCOM_GoogleRecaptcha->check($google_captcha));
exit;
}
result of var_dump : string(0) "" bool(false)
This will return false in every case:
$response = file_get_contents($url);
if($response->success===true) {
return true;
} else {
return false;
}
You need to parse the Json Response from the Recaptcha API:
$response = file_get_contents($url);
$response = json_decode($response , true);
//reCaptcha success check
if($response ['success']){
return true;
} else {
return false;
}
http://php.net/manual/de/function.json-decode.php
I have a little problem in my Shortcode which I am creating for WordPress. The foreach loop is not displaying multiple posts each time. I'm not sure why is it doing this because if I var_dump the $post variable it shows that both the posts are available to that variable, can someone help me out please?
CODE:
function notes_shortcode($atts) {
global $post;
$atts = shortcode_atts( array( 'category' => $args["category"]), $atts, 'notes' );
$args = array( 'category_name' => $atts["category"]);
$posts = get_posts( $args );
$date = get_the_date( 'd', $post->ID );
$month = get_the_date( 'M', $post->ID );
foreach( $posts as $post ) {
setup_postdata($post);
$imgURL = getpostImage( $post->ID );
$title = get_the_title( $post->ID );
$content = substr(get_the_content() , 0, 125);
$post = '<div class="animated fadeInUp" data-animation="fadeInUp" data-delay="200" style="opacity: 0;">';
$post .= '<div class="col-md-4 bloglist">';
$post .= '<div class="post-content">';
$post .= '<div class="post-image">';
$post .= '<div class="flexslider blog-slider">';
$post .= '<div class="overlay" style="opacity: 0;"></div>';
$post .= '<div class="flex-viewport" style="overflow: hidden; position: relative;">';
$post .= '<ul class="slides" style="width: 800%; -webkit-transition: 0s; transition: 0s; -webkit-transform: translate3d(-350px, 0px, 0px);">';
$post .= '<li class="clone" aria-hidden="true" style="width: 350px; float: left; display: block;"> <img src="' . $imgURL . '" alt="" draggable="false"> </li>';
$post .= '<li class="flex-active-slide" style="width: 350px; float: left; display: block;"> <img src="' . $imgURL . '" alt="" draggable="false"> </li>';
$post .= '<li style="width: 350px; float: left; display: block;"> <img src="' . $imgURL . '" alt="" draggable="false"> </li>';
$post .= '<li class="clone" aria-hidden="true" style="width: 350px; float: left; display: block;"> <img src="' . $imgURL . '" alt="" draggable="false"></li>';
$post .= '</ul></div></div></div>';
$post .= '<div class="date-box"><span class="day">' . $date . '</span>';
$post .= '<span class="month">' . $month . '</span> </div>';
$post .= '<div class="post-text">';
$post .= '<h3>' . $title . '</h3>';
$post .= '<p> ' . $content . '<br>';
$post .= ' Read More</p></div></div></div></div>';
return $post;
}
}
add_shortcode( 'notes', 'notes_shortcode' );
function getpostImage($postid) {
if (has_post_thumbnail($post->ID)){
$imgArray = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID), 'thumbnail' );
$imgURL = $imgArray[0];
return $imgURL;
}
}
Thanks ..
Okay, I solved the problem. I used the WordPress Filters to hook the $buff variable and returned it outside the loop, below is the solution if anyone needs it.
function notes_shortcode($atts) {
global $post;
global $buf;
$atts = shortcode_atts( array( 'category' => $args["category"], 'posts_per_page' => $args["posts_per_page"]), $atts, 'notes' );
$args = array( 'category_name' => $atts["category"], 'posts_per_page' => $atts["posts_per_page"] );
$posts = get_posts( $args );
$date = get_the_date( 'd', $post->ID );
$month = get_the_date( 'M', $post->ID );
$buf = '';
$postHolder = array();
foreach( $posts as $post ) {
setup_postdata($post);
$imgURL = getpostImage( $post->ID );
$title = get_the_title( $post->ID );
$content = substr(get_the_content() , 0, 125);
$buf .= '<div class="animated fadeInUp" data-animation="fadeInUp" data-delay="200" style="opacity: 0;">';
$buf .= '<div class="col-md-4 bloglist">';
$buf .= '<div class="post-content">';
$buf .= '<div class="post-image">';
$buf .= '<div class="flexslider blog-slider">';
$buf .= '<div class="overlay" style="opacity: 0;"></div>';
$buf .= '<div class="flex-viewport" style="overflow: hidden; position: relative; max-width: 350px; max-height: 175px; padding-bottom: 15px; margin-bottom: 15px;">';
$buf .= '<ul class="slides" style="width: 800%; -webkit-transition: 0s; transition: 0s; -webkit-transform: translate3d(-350px, 0px, 0px);">';
$buf .= '<li class="clone" aria-hidden="true" style="width: 350px; float: left; display: block;"> <img src="' . $imgURL . '" alt="" draggable="false"> </li>';
$buf .= '<li class="flex-active-slide" style="width: 350px; float: left; display: block;"> <img src="' . $imgURL . '" alt="" draggable="false"> </li>';
$buf .= '<li style="width: 350px; float: left; display: block;"> <img src="' . $imgURL . '" alt="" draggable="false"> </li>';
$buf .= '<li class="clone" aria-hidden="true" style="width: 350px; float: left; display: block;"> <img src="' . $imgURL . '" alt="" draggable="false"></li>';
$buf .= '</ul></div></div></div>';
$buf .= '<div class="date-box"><span class="day">' . $date . '</span>';
$buf .= '<span class="month">' . $month . '</span> </div>';
$buf .= '<div class="post-text">';
$buf .= '<h3>' . $title . '</h3>';
$buf .= '<p> ' . $content . '<br>';
$buf .= ' Read More</p></div></div></div>';
$buf .= apply_filters( 'post_class', '</div>', $atts );
}
$buf .= apply_filters( 'post_class', '', $atts );
return $buf;
}
add_shortcode( 'notes', 'notes_shortcode' );
function getpostImage($postid) {
if (has_post_thumbnail($post->ID)){
$imgArray = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID), 'thumbnail' );
$imgURL = $imgArray[0];
return $imgURL;
}
}
Thankyou all for the help ..
You are returning the function, that means that your are making the function end. What you can do is send the array and then loop it later.Use the code below
function notes_shortcode($atts) {
global $post;
$atts = shortcode_atts( array( 'category' => $args["category"]), $atts, 'notes' );
$args = array( 'category_name' => $atts["category"]);
$posts = get_posts( $args );
$date = get_the_date( 'd', $post->ID );
$month = get_the_date( 'M', $post->ID );
$array = array();
foreach( $posts as $post ) {
setup_postdata($post);
$imgURL = getpostImage( $post->ID );
$title = get_the_title( $post->ID );
$content = substr(get_the_content() , 0, 125);
$post = '<div class="animated fadeInUp" data-animation="fadeInUp" data-delay="200" style="opacity: 0;">';
$post .= '<div class="col-md-4 bloglist">';
$post .= '<div class="post-content">';
$post .= '<div class="post-image">';
$post .= '<div class="flexslider blog-slider">';
$post .= '<div class="overlay" style="opacity: 0;"></div>';
$post .= '<div class="flex-viewport" style="overflow: hidden; position: relative;">';
$post .= '<ul class="slides" style="width: 800%; -webkit-transition: 0s; transition: 0s; -webkit-transform: translate3d(-350px, 0px, 0px);">';
$post .= '<li class="clone" aria-hidden="true" style="width: 350px; float: left; display: block;"> <img src="' . $imgURL . '" alt="" draggable="false"> </li>';
$post .= '<li class="flex-active-slide" style="width: 350px; float: left; display: block;"> <img src="' . $imgURL . '" alt="" draggable="false"> </li>';
$post .= '<li style="width: 350px; float: left; display: block;"> <img src="' . $imgURL . '" alt="" draggable="false"> </li>';
$post .= '<li class="clone" aria-hidden="true" style="width: 350px; float: left; display: block;"> <img src="' . $imgURL . '" alt="" draggable="false"></li>';
$post .= '</ul></div></div></div>';
$post .= '<div class="date-box"><span class="day">' . $date . '</span>';
$post .= '<span class="month">' . $month . '</span> </div>';
$post .= '<div class="post-text">';
$post .= '<h3>' . $title . '</h3>';
$post .= '<p> ' . $content . '<br>';
$post .= ' Read More</p></div></div></div></div>';
$array[] = $post;
}
return $array;
}
add_shortcode( 'notes', 'notes_shortcode' );
function getpostImage($postid) {
if (has_post_thumbnail($post->ID)){
$imgArray = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID), 'thumbnail' );
$imgURL = $imgArray[0];
return $imgURL;
}
}
Hope this helps you
I am using Wordpress.
CSS:
fsrep-main-image {
float: left;
margin-right: 8px;
text-align: center;
overflow: hidden
}
fsrep-main-image img {
padding: 1px;
border: 1px solid #CCC;
float:left;
overflow:hidden
}
description {
display:-block;
margin-top:-150px
}
When I open the page in Firefox it works fine, however if I open the same page in Chrome it has issues.
The following image is from Firefox, but in Chrome the description, location and bedroom details goes on the image.
HTML/PHP:
<?php
$PageContent = '<hr/>';
$WPUploadDir = wp_upload_dir();
$FSREPShowMap = $FSREPconfig['GoogleMap'];
if (isset($FSREPMap)) {
if ($FSREPMap == FALSE) {
$FSREPShowMap = FALSE;
}
}
$ListingDetails = $wpdb->get_row("SELECT * FROM ".$wpdb->prefix."fsrep_listings WHERE listing_id = ".$ListingID[0]);
if ($ListingDetails->listing_address_number == '' || $ListingDetails->listing_address_street == '' || $ListingDetails->listing_address_city == '') { $FSREPShowMap = FALSE; }
if ($FSREPconfig['DisplayCurrency'] == 'Yes') { $CurrencyDisplay = ' '.$FSREPconfig['CurrencyType']; } else { $CurrencyDisplay = ''; }
$PageContent .= '<h1>'.fsrep_listing_name_gen($ListingDetails->listing_id, $FSREPconfig['ListingNameDisplay']).'</h1>';
if ($ListingDetails->listing_price_num != '0.00') { $PageContent .= '<span class="listingprice">'; if ($FSREPconfig['ListingPriceID'] != '') { $PageContent .= fsrep_text_translator('FireStorm Real Estate Plugin', $FSREPconfig['ListingPriceID'].' Label', $FSREPconfig['ListingPriceID']).' '; } $PageContent .= $FSREPconfig['Currency'].fsrep_currency_format($ListingDetails->listing_price_num).$CurrencyDisplay.'</span><br />'; }
$PageContent .= '';
$FSREPImageSizes = fsrep_image_sizes();
$FSREPMainImageMargin = $FSREPImageSizes->main[0] + 4;
$FSREPImageMargin = $FSREPImageSizes->main[0] + 2;
$PageContent .='<div id="vertical_menu" style="float:right">
<a onclick=show_desc()>Overview</a>
<hr/>
<a onclick=show_Location()>Location Map</a>
<hr/>
<a onclick=show_enquiry()>Enquiry</a>
</div>';
$PageContent .= '<div id="fsrep-images" style="display:block">';
if (file_exists($WPUploadDir['basedir'].'/fsrep/houses/large/'.$ListingDetails->listing_id.'.jpg')) {
$PageContent .= '<div id="fsrep-main-image" style="width: '.$FSREPMainImageMargin.'px;display:block"><a id="fsrep-main-image-a" href="'.$WPUploadDir['baseurl'].'/fsrep/houses/large/'.$ListingDetails->listing_id.'.jpg" title="View Slideshow" class="thickbox" rel="fsreplisting"><img id="fsrep-main-image-img" src="'.$WPUploadDir['baseurl'].'/fsrep/houses/'.$ListingDetails->listing_id.'.jpg" alt="'.strip_tags(fsrep_listing_name_gen($ListingDetails->listing_id, $FSREPconfig['ListingNameDisplay'])).'" /></a></div>';
}
$PageContent .= '<div id="fsrep-aimages" style="margin-left: '.$FSREPImageMargin.'px; display:block">';
for ($i=1;$i<=50;$i++) {
if (file_exists($WPUploadDir['basedir'].'/fsrep/houses/additional/small/'.$ListingDetails->listing_id.'-'.$i.'.jpg')) {
//$PageContent .= '<div class="fsrep-aimage" id="fsrep-aimage" style="display:block"><img src="'.$WPUploadDir['baseurl'].'/fsrep/houses/additional/small/'.$ListingDetails->listing_id.'-'.$i.'.jpg" class="full" /></div>';
}
}
$PageContent .= '</div>';
if (file_exists($WPUploadDir['basedir'].'/fsrep/houses/large/'.$ListingDetails->listing_id.'.jpg')) {
//$PageContent .= '<div class="fsrep-aimage" id="fsrep-aimage" style="display:block"><img src="'.$WPUploadDir['baseurl'].'/fsrep/houses/small/'.$ListingDetails->listing_id.'.jpg" class="full" /></div>';
}
$PageContent .= '</div>';
$PageContent .= '<div style="clear: both;"></div>';
if ($FSREPShowMap == TRUE) {
$PageContent .= '<div id="location_map" style="display:none;float:left;width:920px">
<div style="margin-top:-150px;width: 80%;"><h2>'.fsrep_text_translator('FireStorm Real Estate Plugin', 'Located in Label', 'Located in').' '.fsrep_get_address_name($ListingDetails->listing_address_city, 'city').', '.fsrep_get_address_name($ListingDetails->listing_address_province, 'province').'</h2>';
// $PageContent .= '<div class="fsrep-aimager">Map</div>';
$PageContent .= '<div id="listings_map" style="width: 80%; height: 400px; border: 1px solid #999999; margin-bottom: 12px;"></div></div></div>';
$PageContent .= '<br />';
}
/*
$AdditionalImages = '';
for ($i=1;$i<=10;$i++) {
if (file_exists($WPUploadDir['basedir'].'/fsrep/houses/additional/small/'.$ListingDetails->listing_id.'-'.$i.'.jpg')) {
$AdditionalImages .= '<td align="center" valign="center"><img src="'.$WPUploadDir['baseurl'].'/fsrep/houses/additional/small/'.$ListingDetails->listing_id.'-'.$i.'.jpg" class="full" /></td>';
if ($i == 4) {
$AdditionalImages .= '</tr><tr>';
}
}
}
if ($AdditionalImages != '') {
$PageContent .= '<h2>Photo Gallery</h2>';
$PageContent .= '<table><tr><td><img src="'.$WPUploadDir['baseurl'].'/fsrep/houses/small/'.$ListingDetails->listing_id.'.jpg" class="full" /></td>'.$AdditionalImages.'</tr></table>';
$PageContent .= '<p> </p>';
}
*/
if (function_exists('fsrep_pro_listing_child')) { $PageContent .= fsrep_pro_listing_child($ListingDetails->listing_id); }
if ($ListingDetails->listing_description != '') {
$PageContent .= '<div id="description" style="display:block;margin-top:-150px;"><h4 style="display:block;">'.fsrep_text_translator('FireStorm Real Estate Plugin', 'Description Label', 'Description').'</h4>';
$PageContent .= '<p>'.stripslashes(nl2br($ListingDetails->listing_description)).'</p>';
}
$PageContent .= '<p> </p></div>';
$Documents = $wpdb->get_results("SELECT * FROM ".$wpdb->prefix."fsrep_listings_docs WHERE listing_id = ".$ListingDetails->listing_id);
if (count($Documents) > 0) {
$PageContent .= '<h2>'.fsrep_text_translator('FireStorm Real Estate Plugin', 'Documents and Support Material Label', 'Documents and Support Material').'</h2>';
$PageContent .= '<p>';
foreach ($Documents as $Documents) {
$PageContent .= ''.str_replace($ListingDetails->listing_id,'',$Documents->document_name).'<br />';
}
$PageContent .= '</p>';
$PageContent .= '<p> </p>';
}
if ($ListingDetails->listing_virtual_tour != '' || $ListingDetails->listing_slideshow != '' || $ListingDetails->listing_video != '') {
$PageContent .= '<h2>'.fsrep_text_translator('FireStorm Real Estate Plugin', 'Videos and Slideshows Label', 'Videos and Slideshows').'</h2>';
$PageContent .= '<p>';
if ($ListingDetails->listing_virtual_tour != '') {
$PageContent .= ''.fsrep_text_translator('FireStorm Real Estate Plugin', 'Virtual Tour Label', 'Virtual Tour').'<br />';
}
if ($ListingDetails->listing_slideshow != '') {
$PageContent .= ''.fsrep_text_translator('FireStorm Real Estate Plugin', 'Slideshow Label', 'Slideshow').'<br />';
}
if ($ListingDetails->listing_video != '') {
$PageContent .= ''.fsrep_text_translator('FireStorm Real Estate Plugin', 'Video Label', 'Video').'<br />';
}
$PageContent .= '</p>';
$PageContent .= '<p> </p>';
}
Try to separate that in two parts using DIV.
Give float:left; to first DIV
You also need to define the width for the image section.Trying to put the image in a container like div or p tag and specified the width for the image section.
I need to use collections to make dynamic inputs, but needed to pull out the individual elements to integrate them into a Bootstrap layout.
Unfortunately I can't find any documented way of doing this.
Could someone help-me?
Here is my form: http://pastebin.com/JGy7JEJk Fieldset used in form:
http://pastebin.com/VBbG1yyb
Form HTML: http://pastebin.com/HHaZZKsB
Form View Helper: http://pastebin.com/x7B9aPWG
You can see this in action http://protesto21.com.br/cadastro/encargo-vigencia/atualizar/2/
User admin, password p21
Thanks for all and sorry for my english
Problem solved
public function renderCollection($element)
{
$return = '';
if (count($element->getMessages()) > 0) {
$return .= '<div class="form-group has-error">';
} else {
$return .= '<div class="form-group">';
}
foreach ($element->getIterator() as $field) {
$label = ($this->isView) ? '<strong>' . $element->getLabel() . '</strong>' : $element->getLabel();
$return .= '<label class="col-md-3 control-label">' . $label . '</label>';
$return .= '<div class="col-md-8" style="margin-bottom: 20px;">';
foreach ($field->getElements() as $inputs) {
$return .= '<div style="float: left; margin-right: 20px;">';
$return .= $inputs->getLabel();
$return .= $this->renderInput($inputs);
$return .= '<div style="min-width: 265px;">';
foreach ($inputs->getMessages() as $mensagem) {
$return .= "<span class='help-block'>" . $mensagem . "</span>";
}
$return .= '</div>';
$return .= '</div>';
}
$return .= '</div>';
$element->setLabel('');
}
$return .= '</div>';
return $return;
}