i want to give margin bottom to them
code is as shown below,
<div class="dd" id="menu_list_drag">
<?php echo $li; ?>
</div>
where $li is as shown below,
foreach ($p1 as $p) {
$inner_li = "";
$p2 = array_filter($menu, function($a)use($p) {
return $a['parent_id'] == $p['id'];
});
if ($p2) {
$inner_li = $this->generate_li($menu, $p['id']);
}
$li .= "<li class='dd-item' data-id='" . $p['id'] .
"' id='menu-list'><div menu-id='" . $p['id'] . "' id='drag' class='dd-handle'>" . $p['title'] .
"<div style='float:right; margin-bottom:10px' class='dd-nodrag'>"
. "<a class='btn-group btn-group-xs edit_menu' data-toggle='tooltip' id='" . $p['id'] .
"' data-original-title='Edit' onclick='edit_menu($(this))' title='Edit Menu'>"
. "<i class='btn btn-default edit_area fa fa-pencil'></i></a>"
. "<a class='btn-group btn-group-xs delete_menu' id='" . $p['id'] .
"' data-toggle='tooltip' data-original-title='Delete' delete_type='delete_single' onclick='delete_menu($(this))' title='Deactivate Menu'>"
. "<i class='btn btn-default fa fa-trash-o'></i></a></div></div>" . $inner_li . "</li>";
}
$ol = "<ol class='dd-list'>" . $li . "</ol>";
data comes fine but i am unable to give margin bottom to this dd class menu
please help me thank you...
i have used this
.dd-handle{height:35px;}
and it worked for me...!!
Related
I want to customize the product description page of my site which is based on OpenCart by adding an additional field, but i'm unable to fined the file that describes the description page. I have checked the catalog/view/theme/(mytemplate)/product/product.twig file but that's not the file for my product description page.
Adding new field in product description OpenCart 3.X (multilingual).
On the Dashboard of Admin at the right top corner click on Gear icon. In the popup window turn the Cache OFF (both) and Refresh. This is necessary so that the results of your editing can be seen.
1. First of all, you need to add a new field in your database. Using phpMyAdmin, open your DB, find table oc_product_description (oc_ - is my prefix, use yours).
When you open oc_product_description, open SQL tab and write (don't forget to change oc_ to your DB prefix):
ALTER TABLE `oc_product_description` ADD `subtitle` VARCHAR(255) NOT NULL AFTER `name`;
This will add a new column subtitle.
2. Edition admin model admin/model/catalog/product.php
Find (≈12 line)
foreach ($data['product_description'] as $language_id => $value) {
$this->db->query("INSERT INTO " . DB_PREFIX . "product_description SET product_id = '" . (int)$product_id . "', language_id = '" . (int)$language_id . "', name = '" . $this->db->escape($value['name']) . "', description = '" . $this->db->escape($value['description']) . "', tag = '" . $this->db->escape($value['tag']) . "', meta_title = '" . $this->db->escape($value['meta_title']) . "', meta_description = '" . $this->db->escape($value['meta_description']) . "', meta_keyword = '" . $this->db->escape($value['meta_keyword']) . "'");
}
Replace with
foreach ($data['product_description'] as $language_id => $value) {
$this->db->query("INSERT INTO " . DB_PREFIX . "product_description SET product_id = '" . (int)$product_id . "', language_id = '" . (int)$language_id . "', name = '" . $this->db->escape($value['name']) . "', subtitle = '" . $this->db->escape($value['subtitle']) . "', description = '" . $this->db->escape($value['description']) . "', tag = '" . $this->db->escape($value['tag']) . "', meta_title = '" . $this->db->escape($value['meta_title']) . "', meta_description = '" . $this->db->escape($value['meta_description']) . "', meta_keyword = '" . $this->db->escape($value['meta_keyword']) . "'");
}
Find (≈146 line)
foreach ($data['product_description'] as $language_id => $value) {
$this->db->query("INSERT INTO " . DB_PREFIX . "product_description SET product_id = '" . (int)$product_id . "', language_id = '" . (int)$language_id . "', name = '" . $this->db->escape($value['name']) . "', description = '" . $this->db->escape($value['description']) . "', tag = '" . $this->db->escape($value['tag']) . "', meta_title = '" . $this->db->escape($value['meta_title']) . "', meta_description = '" . $this->db->escape($value['meta_description']) . "', meta_keyword = '" . $this->db->escape($value['meta_keyword']) . "'");
}
Replace with
foreach ($data['product_description'] as $language_id => $value) {
$this->db->query("INSERT INTO " . DB_PREFIX . "product_description SET product_id = '" . (int)$product_id . "', language_id = '" . (int)$language_id . "', name = '" . $this->db->escape($value['name']) . "', subtitle = '" . $this->db->escape($value['subtitle']) . "', description = '" . $this->db->escape($value['description']) . "', tag = '" . $this->db->escape($value['tag']) . "', meta_title = '" . $this->db->escape($value['meta_title']) . "', meta_description = '" . $this->db->escape($value['meta_description']) . "', meta_keyword = '" . $this->db->escape($value['meta_keyword']) . "'");
}
Find (≈432 line)
$product_description_data[$result['language_id']] = array(
'name' => $result['name'],
Add below
'subtitle' => $result['subtitle'],
3. Edition admin model admin/controller/catalog/product.php
Find (≈500 line)
if (isset($this->error['name'])) {
$data['error_name'] = $this->error['name'];
} else {
$data['error_name'] = array();
}
Add below
if (isset($this->error['subtitle'])) {
$data['error_subtitle'] = $this->error['subtitle'];
} else {
$data['error_subtitle'] = array();
}
Find
if ((utf8_strlen($value['name']) < 1) || (utf8_strlen($value['name']) > 255)) {
$this->error['name'][$language_id] = $this->language->get('error_name');
}
Add below
if (utf8_strlen($value['subtitle']) > 255) {
$this->error['subtitle'][$language_id] = $this->language->get('error_subtitle');
}
4. Editing admin language admin/language/en-gb(or your admin language)/catalog/product.php
Add at the end
$_['entry_subtitle'] = 'Product Subtitle';
$_['error_subtitle'] = 'Product Subtitle must less than 255 characters!';
5. Edition admin view admin/view/template/catalog/product_form.twig
Find (≈50 line)
<div class="form-group required">
<label class="col-sm-2 control-label" for="input-name{{ language.language_id }}">{{ entry_name }}</label>
<div class="col-sm-10">
<input type="text" name="product_description[{{ language.language_id }}][name]" value="{{ product_description[language.language_id] ? product_description[language.language_id].name }}" placeholder="{{ entry_name }}" id="input-name{{ language.language_id }}" class="form-control"/>
{% if error_name[language.language_id] %}
<div class="text-danger">{{ error_name[language.language_id] }}</div>
{% endif %} </div>
</div>
Add below
<div class="form-group">
<label class="col-sm-2 control-label" for="input-name{{ language.language_id }}">{{ entry_subtitle }}</label>
<div class="col-sm-10">
<input type="text" name="product_description[{{ language.language_id }}][subtitle]" value="{{ product_description[language.language_id] ? product_description[language.language_id].subtitle }}" placeholder="{{ entry_subtitle }}" id="input-subtitle{{ language.language_id }}" class="form-control"/>
{% if error_subtitle[language.language_id] %}
<div class="text-danger">{{ error_subtitle[language.language_id] }}</div>
{% endif %} </div>
</div>
Now we can see new field in Admin panel while edition or adding a product.
Finally, we are going to edit customer side.
6. Edition customer model catalog/model/catalog/product.php
Find (≈10 line)
if ($query->num_rows) {
return array(
'product_id' => $query->row['product_id'],
'name' => $query->row['name'],
Add below
'subtitle' => $query->row['subtitle'],
7. Edition customer controller catalog/controller/product/product.php
Find (≈228 line)
$data['heading_title'] = $product_info['name'];
Add below
$data['subtitle'] = $product_info['subtitle'];
8. Editing customer view catalog/view/theme/default(or your theme)/template/product/product.twig
Find
<h1>{{ heading_title }}</h1>
Add below
<h3>{{ subtitle }}</h3>
Congrats! We have done it! After all thous manipulations you have to clear ocmod cache. Go to Admin, Extensions - Modifications, right top corner button Refresh. Than go back to admin Dashboard, click on right top corner Gear icon. In the popup window turn the Cache ON (both) and Refresh it. More about cache OpenCart 3.X cache cleaning here https://stackoverflow.com/a/61524855/3187127
This is suitable for any OpenCart 3.X, but in in some older 3.X versions you will have to clear twig cache by cleaning storage in file system.
When editing a .twig file in OpenCart 3.x you will often face an issue with Twig Cache. You would edit the file and not see any changes.
To avoid this,
1. go to your admin panel
2. in the top right corner click on the gear icon.
3. turn off twig cache.
let me know if this helps?
I have a website for school where every teacher is going to have a page. Each teacher's page will have a spot for them to upload a PDF. I want this to then show in a viewer on the page so students see the Viewer when they access it.
How would I code into the website allowing the user to upload a PDF and not have it replaced until somebody else uploads a PDF?
so far I have the code to upload a document.
<form method="POST" enctype="multipart/form-data" action="fup.cgi">
File to upload: <input type="file" name="upfile"><br/>
Notes about the file: <input type="text" name="note"><br/>
<br/>
<input type="submit" value="Press"> to upload the file!
</form>
How can I get it to go into a viewer below? and that it saves until replaced.
1 - First thing you are not able to upload file to server but your form action is claiming to use CGI,
2 - Second i cant really get what you want but the following code can upload files to server its in PHP and otherthing are you using SQL or what Database are you using it seems you also need database
<?php
set_time_limit(0);
if(!is_dir("uploads")){
$uploadDir = mkdir("uploads");
}
$allowedExts = array("pdf", "docx", "doc");
$extension = end(explode(".", $_FILES["file"]["name"]));
if ((($_FILES["file"]["type"] == "application/pdf")
|| ($_FILES["file"]["type"] == "application/vnd.openxmlformats-officedocument.wordprocessingml.document")
|| ($_FILES["file"]["type"] == "application/msword"))
&& ($_FILES["file"]["size"] < 200000000000000)
&& in_array($extension, $allowedExts))
{
if ($_FILES["file"]["error"] > 0)
{
echo "Return Code: " . $_FILES["file"]["error"] . "<br />";
}
else
{
echo "Upload: " . $_FILES["file"]["name"] . "<br />";
echo "Type: " . $_FILES["file"]["type"] . "<br />";
echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />";
echo "Temp file: " . $_FILES["file"]["tmp_name"] . "<br />";
if (file_exists("/uploads/" . $_FILES["file"]["name"]))
{
echo $_FILES["file"]["name"] . " already exists. ";
}
else
{
move_uploaded_file($_FILES["file"]["tmp_name"],
"/uploads/" . $_FILES["file"]["name"]);
echo "Stored in: " . "/uploads/" . $_FILES["file"]["name"];
}
}
}
else
{
echo "Invalid file";
}
?>
Do you want to display pdf thumb, icon, or read the pdf
I'm wondering if anyone could provide me with some advice on where I went wrong. I'm trying to get a photo to resize when loaded in a DIV but the photo keeps taking it's own dimensions. Does anyone have any idea why my code isn't working? Thank you in advance!
if($row['coverphoto'] === NULL){
echo"<li>";
echo"<img src='images/slider-4.jpg'>";
echo "<div class='banner'>Customize Your Banner!</div>";
echo "</li>";
}
else{
echo "<li>";
echo "<img style='height:auto; width:auto; max-width:1025px; max-height:503px;' src='/coverphotos/" . $row['coverphoto'] . "'/><br />";
echo "<div class='banner'>Customize Your Banner!</div>";
echo "</li>";
}
?>
Try this,
else{
echo "<li>";
echo "<div style="width:50px;height:50px;"><img style='height:50px; width:50px;' src='/coverphotos/" . $row['coverphoto'] . "'/></div><br />";
echo "<div class='banner'>Customize Your Banner!</div>";
echo "</li>";
}
If it is not worked means, please check your, css file
<li>
styles. May that style makes this mistake.
how do I create a dropdown list in joomla 3.1 for a custom component. I try to create custom fields and I would like to use joomlas dropdown with search
my get input method looks
public function getInput() {
$jinput = JFactory::getApplication()->input;
$sub_id = $jinput->get('sub_id');
$db = JFactory::getDbo();
$query = $db->getQuery(true)
->select('*')
->from('#__unis_faculties')
//->join('#__unis_subjects')
->order('faculty_name');
$db->setQuery($query);
$rows = $db->loadObjectList();
if (isset($sub_id)) {
$actual = $db->getQuery(true)
->select('f.id, f.faculty_name')
->from('#__unis_faculties AS f')
->join('LEFT', '#__unis_subjects AS s ON f.id = s.faculty')
->where('f.id = ' . $sub_id);
$db->setQuery($actual);
$actual_row = $db->loadRow();
}
$html = '';
$html .= '<div class="span12 input-prepend">
<span class="add-on">€ </span>
<input class="span4" name="price" id="price" type="text" />
</div>';
$html .= '<field name="" type="list" default="" label="Select an option" description=""><select>';
foreach ($rows as $row) {
$html .= '<option ' . "selected" ? $row->id = $actual_row->id : '' . 'value="' . $row->id . '" >' . $row->faculty_name . '</option>';
}
$html .= '</select></field>';
return $html;
}
but this does not outputs the desired result, the list won't shows up
the actual code is producing the following dropdown but without to show the elements
I am trying to create a list of actors in a film with a small profile image to the left of the actor's name and their accompanying character, however my images are strangely stacking on top of one another, and I'm not sure why. The cast names, their character and the image are all being pulled in dynamically from an external API.
Below is an image of the current layout:
The accompanying HTML and CSS is below:
HTML
<?php
foreach($tmdb_cast['cast'] as $castMember){
if ($tmp++ < 10)
echo '<img src="http://cf2.imgobject.com/t/p/w45' . $castMember['profile_path'] . '" class="actor_image" alt="' . $castMember['name'] . '" title="' . $castMember['name'] . '" />';
echo '<p>' . $castMember['character'] . ' - ' . $castMember['name'] . '</p>';
}
echo '<p id="morecast">[...view all cast]</p>'
?>
CSS
#cast {
margin-left: 50%;
border: solid 1px red;
}
.actor_image {
float: left;
}
#morecast {
text-align: right;
}
The layout I'm trying to achieve is something similar to the one on display at IMDb, with the actor's name and character vertically aligned with the image:
It looks like you're floating your images, but not applying a "clear" between your image+text units. Try applying a "clear: both;" between each actor instance?
Wrap the image and p elements in a div and have clear:both on the div. Set the inline style to a class. I did it inline as a quick-and-dirty example.
foreach($tmdb_cast['cast'] as $castMember){
if ($tmp++ < 10)
echo '<div style="clear: both;">'
echo '<img src="http://cf2.imgobject.com/t/p/w45' . $castMember['profile_path'] . '" class="actor_image" alt="' . $castMember['name'] . '" title="' . $castMember['name'] . '" />';
echo '<p>' . $castMember['character'] . ' - ' . $castMember['name'] . '</p>';
echo '</div>'
}
I'ts convenient to create a css class that wraps every image and text group:
echo '<div class="actor">
<img src="http://cf2.imgobject.com/t/p/w45' . $castMember['profile_path'] . '" class="actor_image" alt="' . $castMember['name'] . '" title="' . $castMember['name'] . '" />';
echo '<p>' . $castMember['character'] . ' - ' . $castMember['name'] . '</p>
</div>';
And float each container
.actor{
float:left;
clear: left;
}
Now you have a box arround the image+text group that you can float. If this doesn't fix the problem, next step is define the .actor "width" property