PHP - Height Of A Sidebar In A Website.
For a college assignment I was required to make a website. It is after getting graded but I would like to continue to at least try to improve my site. One of the problems I had was the height of the sidebars. I solved the problem by using a javascript script, but I am wondering if it can be done with php?
Similar TutorialsHello to you all, Firstly, I have to admit - I know nothing about PHP coding. That said, I tried to make something work, kinda failed, partly done it, but it's not the way I need it. Let me explain. I'm working on some basic stuff on a woocommerce website. I changed the category tree of the products and now there are categories nested quite deep. Like - Parent category -> Subcategory -> Nested category -> Further nested category. That last piece wasn't showing on the sidebar, so I digged and found the PHP code responsible for showing categories. Upon finding the "Nested category" code, I simply copy-pasted it in a right place and then added CSS "display:block" rule. Now, the "Further nested category" is showing, when "Nested category" is active. But, here are the problems: 1. If there are multiple categories of that last depth for various "Nested categories", they are all showing; 2. When I click on a link of any "Further nested category", the page redirects correctly and shows all the required products, but the category tree is shrinking to "Parent categories" only. The store url is: https://skorpion.info.pl/sklep/. The problem #1 can be seen he https://skorpion.info.pl/kategoria/naczynia-i-przybory/naczynia-kuchenne-naczynia-i-przybory/ - as you can see, both "Garnki" and "Patelnie" nested categories show all of their consecutive further nested subcategories. The problem number two can be seen he https://skorpion.info.pl/kategoria/naczynia-i-przybory/naczynia-kuchenne-naczynia-i-przybory/patelnie-naczynia-kuchenne-naczynia-i-przybory/patelnie-aluminiowe/. The categories should remain visible. Let me post the code below, I'll mark with a comment the block I copy-pasted. I really hope someone can help me here, I would be massively thankful. Cheers! <aside class="sidebarWrapper"> <?php $types = array( 'hendi' => 'Hendi', 'stalgast' => 'Stalgast', 'bartscher' => 'Bartscher', 'kromet' => 'Kromet', 'hiendkitchen' => 'Hiendkitchen', ); ?> <ul class="parent-list"> <?php foreach ($types as $type => $value) : ?> <li> <a href="<?php echo home_url(); ?>/hurtownie/<?php echo $type; ?>"><?php echo $value; ?></a> </li> <?php endforeach; ?> </ul> <h2 class="title"> Kategorie <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" id="Layer_1" x="0px" y="0px" viewBox="0 0 492.004 492.004" style="enable-background:new 0 0 492.004 492.004;" xml:space="preserve" width="512px" height="512px"> <g> <g> <g> <path d="M382.678,226.804L163.73,7.86C158.666,2.792,151.906,0,144.698,0s-13.968,2.792-19.032,7.86l-16.124,16.12 c-10.492,10.504-10.492,27.576,0,38.064L293.398,245.9l-184.06,184.06c-5.064,5.068-7.86,11.824-7.86,19.028 c0,7.212,2.796,13.968,7.86,19.04l16.124,16.116c5.068,5.068,11.824,7.86,19.032,7.86s13.968-2.792,19.032-7.86L382.678,265 c5.076-5.084,7.864-11.872,7.848-19.088C390.542,238.668,387.754,231.884,382.678,226.804z" data-original="#000000" class="active-path" data-old_color="#000000" fill="#F1B63E" /> </g> </g> </g> </svg> </h2> <div class="slideDown-wrapper"> <?php $cate = get_queried_object(); $cateID = $cate->term_id; $cateParentID = $cate->parent; $mainCateParentObject = get_term($cateParentID); $mainCateParentID = $mainCateParentObject->parent; $args = array( 'taxonomy' => 'product_cat', 'hide_empty' => false, 'parent' => 0, 'orderby' => 'title', 'order' => 'asc' ); $product_cat = get_terms($args); foreach ($product_cat as $parent_product_cat) : ?> <ul class="parent-list"> <li class="<?php if ($parent_product_cat->term_id == $cateID || $parent_product_cat->term_id == $cateParentID || $parent_product_cat->term_id == $mainCateParentID) echo 'active'; ?>"> <a href="<?php echo get_term_link($parent_product_cat->term_id); ?>"> <?php echo $parent_product_cat->name; ?> </a> <?php if ($parent_product_cat->term_id == $cateID || $parent_product_cat->term_id == $cateParentID || $parent_product_cat->term_id == $mainCateParentID) : ?> <ul class="child-list"> <?php $child_args = array( 'taxonomy' => 'product_cat', 'hide_empty' => false, 'parent' => $parent_product_cat->term_id ); $child_product_cats = get_terms($child_args); foreach ($child_product_cats as $child_product_cat) : ?> <li class="<?php if ($child_product_cat->term_id == $cateID || $child_product_cat->term_id == $cateParentID) echo 'active'; ?>"> <a href="<?php echo get_term_link($child_product_cat->term_id); ?>"> <?php if ($child_product_cat->term_id == $cateID) echo '<strong>'; ?> <?php echo $child_product_cat->name; ?> <?php if ($child_product_cat->term_id == $cateID) echo '</strong>'; ?> </a> <ul class="child-list"> <?php $child_args = array( 'taxonomy' => 'product_cat', 'hide_empty' => false, 'parent' => $child_product_cat->term_id ); $child_product_cats = get_terms($child_args); foreach ($child_product_cats as $child_product_cat) : ?> <li> <a href="<?php echo get_term_link($child_product_cat->term_id); ?>"> <?php if ($child_product_cat->term_id == $cateID) echo '<strong>'; ?> <?php echo $child_product_cat->name; ?> <?php if ($child_product_cat->term_id == $cateID) echo '</strong>'; ?> </a> <!-- COPY-PASTED CODE FROM ABOVE--> <!-- --> <!-- --> <ul class="child-list" id="child-4-nest"> <?php $child_args = array( 'taxonomy' => 'product_cat', 'hide_empty' => false, 'parent' => $child_product_cat->term_id ); $child_product_cats = get_terms($child_args); foreach ($child_product_cats as $child_product_cat) : ?> <li> <a href="<?php echo get_term_link($child_product_cat->term_id); ?>"> <?php if ($child_product_cat->term_id == $cateID) echo '<strong>'; ?> <?php echo $child_product_cat->name; ?> <?php if ($child_product_cat->term_id == $cateID) echo '</strong>'; ?> </a> </li> <?php endforeach; ?> </ul> <!-- END OF COPY-PASTED CODE--> <!-- --> <!-- --> </li> <?php endforeach; ?> </ul> </li> <?php endforeach; ?> </ul> <?php endif; ?> </li> </ul> <?php endforeach; ?> </div> </aside> <aside class="saleProductsWrapper container p-0"> <h2 class="title">Promocje</h2> <div class="row"> <?php $cate = get_queried_object(); $cateID = $cate->term_id; $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; $loop = new WP_Query(array( 'post_type' => 'product', 'post_status' => 'publish', 'posts_per_page' => '1', 'meta_query' => array( array( 'key' => '_sale_price', 'value' => 0, 'compare' => '>', 'type' => 'numeric' ) ), 'orderby' => 'rand' )); while ($loop->have_posts()) : $loop->the_post(); ?> <div class="col-lg-12"> <?php get_template_part('template-parts/product'); ?> </div> <?php endwhile; wp_reset_query(); ?> </div> </aside>
I'm trying to make a League of Legends (a video game) community website, both as a personal project and for practice. Now the game has a lot of champions, each of whom have 5 unique abilities. Now, I thought about manually inputting all the details about each champion into a MySQL database, but that would long and tedious, and I don't really have the time for it now. Also, the game patches very oftern (like, once every 2 weeks) which changes many of the stats, etc. of the champion, and it is not possible for me to keep manually updating these every time there is a patch. Fortunately, there is a League of Legends Wiki which has all the data I need in their specific champion pages, which they keep updated per patch. So I was wondering if there was any way to get the data from the divs in the wiki, and have it display on my site. What I want to do in my website is that whenever someone types a champion's name (in a post or whatever), I want it to display a hover-over dialog with some of the champions details. And a lot of other features such as that. In plain English I need a way to : > Tell PHP to go to the wiki's source code on a specific page > Find a specific div container > Get X data from there > Pass X data into a function to display the hover-over I think this way, I would not have to maintain a database as I can leech off the wiki's data. I have not coded anything like this before, so I would like a few pointers as to how to achieve this. Any help will be appreciated! I tried searching on google but couldn't find any relevant information, please redirect me to relevant source or help me with the code. I want to pass a domain name in text field which will be scanned and then the script will display entire site map. Not external links or links on a page. Sorry it is not easy for me to explain. Eg. if i pass abc.com Script will display abc.com/12/adn.php abc.com/asd/asd/ etc Whatever their url format is. All the links on that domain. hello My database is in a same server with seperate domain name , then I want to insert from website1 mysql data on website2 mysql data. can anyone help me? Is it possible to download files from a website to my online websites root directory? reason I'm asking is because I have been downloading large video files to my computer which take about 20 minutes!! Then I use FTP to upload them to my site but it takes about 2-3 hours per video!! I was looking for a faster way! All help would be great! Hi there. How can i set up a maximum width and height of a picture? For example: the limit is 400x400. So if the photo is 200x200 then it stays that way, however if a photo is 550x550 then it gets resized to 400x400. I have a code that will get the value of amount from $_GET, and it adds it to an image I have stored. My problem is the that image I use is 32x32, but I need to add more height to it to make it look correct. The image is transparent so I'd need to keep that also. The code I have now works, but the value of amount is on top of the image where I don't want it to be. Here's my code. <?php header("Content-type: image/png"); $image = $_GET['image'] .'.png'; $img_handler = imageCreateFromPNG("./item images/" . $image); imagesavealpha($img_handler, true); $color = ImageColorAllocate($img_handler, 204, 156, 12); ImageString($img_handler, 2, 0, 0, $_GET['amount'], $color); ImagePng($img_handler); ImageDestroy($img_handler); ?> Hello, im new to css and i need a little help creating a navigation bar which is horizontal, i want it to fill its containing divs height.
here is the simple html
<div id="nav-bar"> <ul> <li>item 1</li> <li>item 2</li> <li>item 3</li> <li>item 4</li> </ul> </div>here is the css being used #nav-bar { background-color: #494c51; width: auto; position: relative; height: 44px; border-style: solid; <!-- background-color: #242528; This is the color of the hover --> border-color: #000; border-width: thin; } #nav-bar ul, li { padding: 0; list-style-type: none; display: inline; line-height: 44px; <!-- this aligns the ul/li into the middle virtically --> height: 44px; border-bottom-color: red; border-style: solid; }so #nav bar has a height of 44px which is working, so i assumed i could set height of #nav-bar ul, li to 100% and it would work, but it doesnt, i have also tried putting these values in a new div but that didnt work either. can anyone help me with this? thanks Hello everybody, I have a problem with my site I am making.
http://gmann.gflclan.com/index.php (this is a test site, I am not even near close to being done with it).
The problem I am having is, when I make my browser smaller, the navbar body doesn't move down (expand).
#navbar { width:auto; height: 5%; position:relative; background:url(images/transbg4.png); border-radius:15px 15px 0px 0px; box-shadow: 5px 5px 10px #121212; margin-left: 30%; margin-right: 30%; color: white; text-align: left; }There's the code. I think it has to do with "height: 5%;". Do you guys have any idea on how to fix this. I am learning coding, and sorry if this is a "noob" question. Also, if you want, feel free to give suggestions for the site, I already know it looks horrible but I plan on making it better in the future. Here is the navbar in the PHP file I made: <div id="navbar"> <ul id="nav_links"> <?php $query = "SELECT * FROM `navlist` ORDER BY `lorder` ASC"; $result = mysqli_query($db, $query) or die ('Error with the nav list query! Error: ' . mysqli_error($db)); while ($nav = mysqli_fetch_assoc($result)) { echo '<div class="navlink">'; $target = ''; if($nav['newpage'] == 1) { $target = 'target=_blank'; } else { $target = ''; } echo '<li class="nav_button"><a href="' . $nav['link'] . '" ' . $target . '>' . $nav['name'] . '</a></li>'; echo '</div>'; } ?> </ul> </div>Thanks, Gamemann What I am working on is a background to a user input comment -- essentially a framed box around the comment. For some reason I cannot fathom but which is probably simple, I can't get the image height variable, (set by the length of the comment) to be seen by the code outputting the framed box. So here's what I got: To set the image position and height variables I put this code inside of a while loop, since there are multiple comments in the DB: Code: [Select] //Looks at the comment in the DB //Calculates the number of lines based on 75 characters per line $line_count = ceil(strlen($row3['comment'] /75)); //This sets the position of the username who posted the comment $username_pos = ($text_pos + ($line_count * 33)) . ".00pt"; //Sets the initial starting position of the framed box on the page $box_pos = $text_pos - 42.00 . ".00pt"; //Sets the height of the framed box $box_ht = $username_pos + 50 . ".00pt"; //Outputs the framed box echo "<img src='images/blue table.gif' style='position:absolute; left:140.00pt; top:$box_pos'; height:$box_ht'; width = 570.00pt; z-index:-1 class='cc01'>"; There is also code outputting the comment and username which seems to work just fine. The result is a pretty box framing the comment, but the outputted image always ends up with the same height, which obviously doesn't work because each comment in the DB can have a different number of lines and would need a different size box. Just to be clear, the source image is much larger than what can be produced by this code. If anyone has any suggestions, I'd really appreciate it. Thanks! I have put together a new website and I am having a problem that is frustrating me to no end so I am here looking for expert help.
In my "content" column, I am trying to have the article I have written. This content is going to change from page to page depending on the amount of content. At the bottom of the "content" I am trying to add a comments section.
To the right of the "content" column I have a "sidebar" and the problem I am having is as the "content" column grows or shrinks, it is effecting the positioning of the "sidebar" and moves the content of the "sidebar" up or down.
I have tried to investigate how to correct this and what I have read makes absolutely no sense to me so the only way I can figure out to fix this (keeping in mind that I am in the process of teaching myself CSS and I use the trial and error method of learning) is to set the height of the "content" column to a fixed number and then force the "sidebar" to move up or down by using something like 'margin-top: -1200px". The problem with this is when comments are added, the content of the "sidebar" moves down.
My question is, does anyone know of a way to get both columns to adjust to equal heights that won't cause me to pull what little hair I have left out? Would that anyone be willing to explain to me why your method should work?
I know that I should include the code for the page I am having the problem with, but it is (in my opinion) pretty extensive and if someone is willing to try to tackle this it might be easier to just bring up the source code.
Just FYI . . . the page in question can be seen at http://pickmysmoker....ne_smokers.php/
Thanks in advance . . .
i am uploading image to s3 server and by php i am making a copy of that image on server , if i upload an image of 2.3 mb than the width of image is not coming but if i upload less size image like 26kb than it is showing the width of image so it is able to create the copy . here is my code of php : $s3 = new S3(awsAccessKey, awsSecretKey); $thumbId = uniqid(); $thumbId .= ".jpg"; $img = ''; if($imgType == "image/jpeg"){ $img = imagecreatefromjpeg($sourceUrl); }else if($imgType == "image/png"){ $img = imagecreatefrompng($sourceUrl); }else if($imgType == "image/gif"){ $img = imagecreatefromgif($sourceUrl); }else{ $img = imagejpeg($sourceUrl); } echo $width = imagesx( $img ); echo $height = imagesy( $img ); please tell me what is the problem with size of image.. regards rahul This topic has been moved to CSS Help. http://www.phpfreaks.com/forums/index.php?topic=349596.0 Hi People. Thanks for all the help on here in the past, you have been brilliant. I run the airfield cards.com website and have a script in the output page that is as follows. Code: [Select] To Embed this Card into your website, cut and paste the following code: <input name="generate" value="<? echo "<iframe src='http://www.airfieldcards.com/php/courtesy_card.php?id=".$id. "' ></iframe>";?>"> Now the way it shows on the site is like this Code: [Select] <iframe src='http://www.airfieldcards.com/php/courtesy_card.php?id=165' ></iframe> So, I look at the iframe code from google that should be cut and pasted into a website (obviously it's working code from google) Code: [Select] <iframe width="700" height="1500" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://maps.google.co.uk/maps/ms?msa=0&msid=203054009368331462137.0004aa731e7de2e86a0e0&ie=UTF8&t=h&vpsrc=0&ll=53.800651,-4.042969&spn=80.03397,61.435547&z=4&output=embed"></iframe><br /><small>View <a href="http://maps.google.co.uk/maps/ms?msa=0&msid=203054009368331462137.0004aa731e7de2e86a0e0&ie=UTF8&t=h&vpsrc=0&ll=53.800651,-4.042969&spn=80.03397,61.435547&z=4&source=embed" style="color:#0000FF;text-align:left">AirfieldCards.com</a> in a larger map</small> Now I have tried to take the code from the google iframe (width/height/scrolling/etc) and paste it into my source but it doesn't work. Here's how I have done it. Code: [Select] To Embed this Card into your website, cut and paste the following code: <input name="generate" value="<? echo "<iframe width="700" height="1500" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src='http://www.airfieldcards.com/php/courtesy_card.php?id=".$id. "' ></iframe>";?>"> Can someone please modify my fist lot of code so that I have the correct height and width settings (700 x 1500) Thanks in advance Regards Vince Gledhill Hi Fellas, having a bit of a brain freeze here, i am trying to set a max width or height for a uploaded image, but my brain has frozen, maybe its the cold weather lol list($width,$height)=getimagesize($uploadedfile); $newwidth=250; $newheight=($height/$width)*$newwidth; $tmp=imagecreatetruecolor($newwidth,$newheight); basicly i want to find the biggest size of an image, beit width or height then set that size to 250... Any pointers here? Hey guys! I have the following php code that grabs variables (and the browsed image) from Flash. //FLASH VARIABLES $Name = $_POST['Name']; $itemNumber = $_POST['itemNumber']; $filename = $_FILES['Filedata']['name']; $filetmpname = $_FILES['Filedata']['tmp_name']; $fileType = $_FILES["Filedata"]["type"]; $fileSizeMB = ($_FILES["Filedata"]["size"] / 1024 / 1000); list($filename, $extension) = explode('.', basename($_FILES['Filedata']['name'])); $filename = $Name; $target = $filename . $itemNumber . "." . $extension; // Place file on server, into the images folder move_uploaded_file($_FILES['Filedata']['tmp_name'], "images/".$target); This works perfect, but what I want to change is the width and height of the uploaded image. Any ideas/suggestions on how this could be done? Thanks in advance!! Cheers! Hi folks, I'm using this code to display a picture that is uploaded in a form. Code: [Select] print "<img src='http://www.coast2kosci.com/mylongrun/test/photo_uploads/$imgx' width='300' height='300' alt='Your photo' />"; At first I tried specifying only the width, without the height. But for tall photos, the display wasn't really what I was after. Then I specified both width and height, which results in a mis-scaled photo. Is there any way that I can specify the height and width atributes as a sort of maximum / or limiter. Ie: If the height is greater than the width, limit the height to 300, and if the width is greater than the height, limit the width to 300? Thanks for your time, Dave Hey guys I have a small issue, i have an upload that resizes the image into thumbnail by max width and ratios the width based on that. Here is my code
What I am wanting to do is instead upload the image with a max height and ratio the width proportionally. What variables do I have to reverse? I have folder with 100's images, how to find Height and width as Excel sheet? Okay, so here is the deal. Have a table which stores image as blob files. Now i want to read the image width and height directly from the blob field. Is this possible and if yes, how? Things i tried so far; list($size[0],$size[1],$type, $attr) = getimagesize('image.php?i=26ddd45b02859e836d13d4b9fde34281'); print_r($size); $img = 'image.php?i=26ddd45b02859e836d13d4b9fde34281'; echo imagesy($img); image.php grabs the image from DB and show's it with header("Content-type: image/jpg"); It works for just showing the images with the <img> tag. Any ideas of help would be great! |