Hide label class in div - php

For 2 days I didn't understand why my pictures aren't uploaded onto my server correctly.
I am using osclass and in my theme I have this :
<?php if( osc_price_enabled_at_items() ) { ?>
<div class="control-group">
<label class="control-label" for="price"><?php _e('Recompensa', 'infinity'); ?></label>
<div class="controls">
<?php ItemForm::price_input_text(); ?>
<?php ItemForm::currency_select(); ?> ( optional )
</div>
</div>
<?php } ?>
I was partially able to achieve what I wanted: when someone chooses a category where the price is off, the label with text price disappears, but I still have the problem that my pictures don't upload.
This was my code, but with this the text PRICE is not disappearing, only the text area is:
<?php if( osc_price_enabled_at_items() ) { ?>
<div class="control-group">
<label class="control-label" for="price"><?php _e('Price', 'bender'); ?></label>
<p class="controls">
<?php ItemForm::price_input_text(); ?>
<?php ItemForm::currency_select(); ?> ( optional )
</div></p>
</div>
<?php } ?>

This is the problem
<p class="controls">
should be
<div class="controls">
Unless there is something I'm missing.

i was able to adjust this , was my mistake , the last from my code was in addition i deleted and now is ok , my server uploads pictures with no problem , thank you all

Related

user profile 2 new phone fields

Hi guys how do i add 2 new phone fields on the user profile page on Osclass?
This is what i try already!
I the database i add 2 new fields in the t_user
s_phone_mobile2
s_phome_mobile3
oc-content/themes/ctg_housing/user-profile.php
<label class="control-label" for="phoneMobile2">
<?php _e('2 Mobile #', 'ctg_housing'); ?>
(<?php _e('optional', 'ctg_housing'); ?>)
</label>
<?php UserForm::phone_mobile2_text(osc_user()); ?>
<label class="control-label" for="phoneMobile3">
<?php _e('3 Mobile #', 'ctg_housing'); ?>
(<?php _e('optional', 'ctg_housing'); ?>)
</label>
<?php UserForm::phone_mobile3_text(osc_user()); ?>
oc-includes/osclass/UserActions.php
$input['s_phone_mobile2'] = trim(Params::getParam('s_phone_mobile2'));
$input['s_phone_mobile3'] = trim(Params::getParam('s_phone_mobile3'));
Hope someone can help!
Thanks

php mysql select with different values

I have a table with exercises and I want to generate I want that the visitor can select the number of exercises that him wants... every exercise must be appear in a different select and I need that the first value in every select will be different. I have this code:
<form class="form-horizontal" action="wod_auto_sartu.php" method="post" enctype="multipart/form-data">
<?php
$numbers = range(1, 12);
shuffle($numbers);
for ($i=1;$i<=$num_jornadas;$i++){
$numbers2=$numbers[$i];
$random_wod=$wod[$numbers2];
?>
<div class="form-group">
<label for="inpuName" class="col-md-4 control-label"><font color="#fff"><b><?php echo _("Jornada: $i"); ?></b></font></label>
<div class="col-md-6">
<select class="form-control c-square c-theme" id="wod" style="opacity: .8;max-width:80%;" name="num_jornadas" method="post">
<?php
foreach ($numbers as $row){
echo '<option value='. $random_wod[0] .'>'. $random_wod[1] .'</option>';
}
?>
</select>
</div>
</div>
<?php
}
?>
In this moment, I get info as I have mentioned, but if I unfold the select I get the same value in all options, I need as I said that the first option in every option will different but when I unfold, I need see all other exercises, not the same...
How can I solve it?
Example image
Problem solved!! I had an error of concept... I was introducing the same array all the time waiting for a different output ... as Einstein said... "Stupidity is repeating the same error expecting different results"
The correct code:
<form class="form-horizontal" action="wod_auto_sartu.php" method="post" enctype="multipart/form-data">
<?php
$lista_wods = array();
foreach($wod as $row=>$value):
$lista_wods[] = '<option value="'.$row.'">' .$value[1].'</option>';
endforeach;
$numbers = range(1, 12);
shuffle($numbers);
for ($i=1;$i<=$num_jornadas;$i++){
$numbers2=$numbers[$i];
$random_wod=$wod[$numbers2];
?>
<div class="form-group">
<label for="inpuName" class="col-md-4 control-label"><font color="#fff"><b><?php echo _("Jornada: $i"); ?></b></font></label>
<div class="col-md-6">
<select class="form-control c-square c-theme" id="wod" style="opacity: .8;max-width:80%;" name="num_jornadas" method="post">
<?php
print_r ('<option value='. $random_wod[0] .'>'. $random_wod[1] . '</option>');
print_r(array_values($lista_wods));
?>
</select>
</div>
</div>
<?php
}
?>
Thanks to those who have tried to help me!

Set default value in form field

I have a form in a Joomla component in which the user needs to select a country and then a city depending on the country selected. In my case I only need one country. How can I edit or replace the code below to set the country to a default value and remove it from the form?
<div class="form-group">
<label for="submit-location"><?php echo JText::_('COM_BT_PROPERTY_LOCATION');?></label>
<?php echo $this->form->getInput('country'); ?>
</div>
<div class="form-group">
<?php echo $this->form->getInput('city'); ?>
</div>
Thank you for your time. Any suggestion is much appreciated!

Osclass osc_user_phone () is not working

Recently i use this function to hide the last numbers of osc_user_phone() in Osclass 3.6.1
jQuery
<script>
$(document).ready(function(){
$("#showPhone").click(function () {
$("#showPhone").hide();
$("#hidePhone").show();
});
$("#hidePhone").click(function () {
$("#showPhone").show();
$("#hidePhone").hide();
});
});
</script>
HTML
<?php _e('user phone'); ?> :
<span>
<a href="#" id="hidePhone" style="display: none;">
<?php echo osc_user_phone_mobile(); ?>
</a>
</span>
<span>
<a href="#" id="showPhone">
<?php echo substr(osc_user_phone_mobile(),0,-4).'XXXX'; ?>
</a>
</span>
Up here everything is ok. If complete the Phone Cell field in User profile is ok, the phone number show in item page.
If post a new ad, without account and complete the Cell Phone input, the phone number not showing in item page.
from item-post.php, problem is here (i hope)
<div class="control-group">
<label class="control-label" for="phoneMobile"><?php _e('Cell phone', 'infinity'); ?></label>
<div class="controls">
<?php UserForm::mobile_text(osc_user()); ?>
</div>
</div>
and from user-profile.php, the cell phone input:
<div class="control-group">
<label class="control-label" for="phoneMobile"><?php _e('Cell phone', 'infinity'); ?></label>
<div class="controls">
<?php UserForm::mobile_text(osc_user()); ?>
</div>
</div>
the same code that item-post.php
How do input field to work and when user posted new ad the phone number show in the item page?
In osclass 3.7.1 (bender theme) I managed to put the registered user phone into item-post.php
The code:
<?php if(osc_is_web_user_logged_in()) { ?>
<?php if (!$edit) { ?>
<div class="control-group">
<label class="control-label" for="phoneLand"><?php _e('Phone', 'bender'); ?>*</label>
<div class="controls">
<?php UserForm::phone_land_text(osc_user()); ?>
<p style="font-size: 0.85em; color:red;">* empty => <u>it will miss from all the listings !</u></br>* filled => <u>it will show in all the listings !</u></p>
</div>
</div>
<?php } ?>
<?php if ($edit) { ?>
<div class="control-group">
<label class="control-label" for="phoneLand">The <?php _e('Phone', 'bender'); ?></label>
<div class="controls">
<p style="font-size: 0.85em;"> can be edited here.</p>
</div>
</div>
<?php } ?>
<?php } ?>
When submitting the page, Osclass checks whether it's a registered user or a non-registered user that is publishing an item.
If it founds a user id, infos are stored in the oc_t_user that has a s_phone_land and s_phone_mobile.
When a non-registered user is publishing an item, his infos are stored into the oc_t_item table in the database. Unfortunately, it only saves the s_contact_name and s_contact_email, no field is available is this table for the phone.
Then, your phone input field is submitted but just not taken into account by the controller. You can see the process in controller/item.php and ItemActions.php.
You might want to look at the prepareData() method in ItemActions.php, around lines 1100 to 1110:
if( $userId != null ) {
$aItem['contactName'] = $data['s_name'];
$aItem['contactEmail'] = $data['s_email'];
Params::setParam('contactName', $data['s_name']);
Params::setParam('contactEmail', $data['s_email']);
} else {
$aItem['contactName'] = Params::getParam('contactName');
$aItem['contactEmail'] = Params::getParam('contactEmail');
}
$aItem['userId'] = $userId;

How to pass image from one page to other using PHP?

I have been trying to execute the code for long time but rest then my image all other variables are working. My images are stored in server folder called "uploaded".
I have two pages called "show.php" and "readmore.php", and I want to pass the image from show.php to readmore.php but other then image all the variables are displaying in readmore.php.
My code for show.php
<a class="btn" href="readmore.php?ad_title=<?php echo $rec['ad_title']; ?> & price= <?php echo $rec['price']; ?> & address= <?php echo $rec['address']; ?> & phone= <?php echo $rec['m_number']; ?> & description= <?php echo $rec['description']; ?> & contact_name= <?php echo $rec['contact_name'] ; ?> & photo_name= <?php echo $rec['photo_name']?>;">
My code for readmore.php (I am displaying here two of the variables along with the image)
<div class="control-group">
<label class="control-label">About the book</label>
<div class="controls">
<label class="checkbox">
<?php echo $_GET['description'];?>
</label>
</div>
</div>
<div class="control-group">
<label class="control-label">About the book</label>
<div class="controls">
<label class="checkbox">
<td id="pic" width="300px"><img src= "../uploaded/<?php echo $_GET['photo_name'];?>" style="border-radius:5px; padding:3px; "/></td>
</label>
</div>
</div>
Learn to debug:
On first lines of readmore.php dump the superglobal variable $_GET and see whether value of $_GET['photo_name'] is coming or not.
Eg.
echo "<pre>";
print_r($_GET);
echo "</pre>";
P.S. <pre> tag is just for formatting the output. print_r dumps the values of $_GET.
If you see value of 'photo_name' index in the GET array,
there should be some errors in your image path.

Categories