Everything posted by robinmujician
-
Declaring all variables at start of program
Thanks A, Samus and DY40, I'll definitely look into design patterns and play around with variable scope. Regards, R.
-
Declaring all variables at start of program
Hi there, I'm fairly new to php and I've got a question about the overall structure of php programs, with particular reference to declaring variables and using them in functions. I've read that an important part of programming is planning, and that that includes making a list of all variables to be used in a progam. It makes sense to me to begin a program by declaring/defining all the variables to be used, as doing so provides a clear reference and also just seems like the 'logical' thing to do, as it gets that part of the 'to do' list sorted from the offset. The trouble is, that if the program contains functions, then of course these functions don't have access to the declared variables. Making all variables global would solve this, but that can't be right! The other alternative I can think of is to simply list the variables as part of a comment. I'm curious to know how experienced php programmers deal with this. The reason it came to my attention is that I was writing a function that made use of a long array, and it occured to me that functions were meant to be neat and compact, and the long array definition looked out of place. Maybe the answer is to use a database...? Regards, Robin.
-
Hover Zoom Effect in Wordpress
This might be a bit of a tall order, but I'm stuck and need some help. I'm working on a site for someone who is very keen to have a hover zoom effoect on his images. I'm using Worpdress with ng gallery. I'd like the effect to apply to singlepic view in ng gallery. My PHP and JS skills are fairly rudimentary, but I've found a couple of scripts which look like they might do the job: http://thecodeplayer.com/walkthrough/magnifying-glass-for-images-using-jquery-and-css3 and http://www.mind-projects.it/projects/jqzoom/ The trick is to get them to apply to the ng gallery display template which looks like this: <?php /** Template Page for the single pic Follow variables are useable : $image : Contain all about the image $meta : Contain the raw Meta data from the image $exif : Contain the clean up Exif data from file $iptc : Contain the clean up IPTC data from file $xmp : Contain the clean up XMP data from file $db : Contain the clean up META data from the database (should be imported during upload) Please note : A Image resize or watermarking operation will remove all meta information, exif will in this case loaded from database You can check the content when you insert the tag <?php var_dump($variable) ?> If you would like to show the timestamp of the image ,you can use <?php echo $exif['created_timestamp'] ?> **/ ?> <?php if (!defined ('ABSPATH')) die ('No direct access allowed'); ?><?php if (!empty ($image)) : ?> <a href="<?php echo $image->imageURL ?>" title="<?php echo $image->linktitle ?>" <?php echo $image->thumbcode ?> > <img class="<?php echo $image->classname ?>" src="<?php echo $image->thumbnailURL ?>" alt="<?php echo $image->alttext ?>" title="<?php echo $image->alttext ?>" /> </a> <?php if (!empty ($image->caption)) : ?><span><?php echo $image->caption ?></span><?php endif; ?> <?php endif; ?> The code from the first JS uses a background image, which might be harder to tweak/implement. I can see that the ability to make this work is within my grasp, but a serious stretch on my ability, so any help would be very much appreciated. Regards, Robin
-
Logos again...
I'd definitely like to do this as career eventually! I'm getting more comfortable with css and HTML, and even learned a bit of PHP. The learning curve is not smooth though - like learning any subject I guess there's periods of obvious growth, then times when it's all being integrated and it seems like not much is happening. Re the text, I tried the trick of doubling the size of the image and using css to shrink it, but the original text was so bad that it didn't make enough of a difference. It may not be perfect, but the "text image" made by CoolText is considerably smoother than what I did in PS!
-
Logos again...
Thanks again guys. I've just found an online logo maker called "cool text."(http://cooltext.com/). It generates pngs of text, and what I don't get is how when I zoom in on my browzer, the quality remains smooth, which is how I would expect a vector image to behave. Anyone care to explain? R
-
Logos again...
Hi there, I've hit a bit of a brick wall with my web design learning curve. Seems like every site needs a good logo, and I'm really confused about how to produce them. I've got photoshop, and know the basics of how to use it, but it seems the resolution of the text it produces is just too low to look good on the web. For example I want to make a logo/banner/what's it actually called? like this: What I need to know, is how would a pro go about producing something like this? I'm aware of the distinction between vector and raster graphics, and I can produce svgs using Inkscape. I want to avoid this solution though, because i use wordpress, and the svg support is unreliable, and I want my logos to display on all browsers. I've heard that other programs like Indesgn are better because they use vector graphics for text, but I don't know if that means that files are saved as svgs? I'm guessing there must be a fairly easy solution since so many websites have perfectly good logos, and they can't all be svgs? Is it maybe jsut a case of learning more about PS, including all the anit-aliasing options? or using only smaller sized text? Or what? Any help much appreciated, Robin.
-
Vertical alignment for logo
Thanks again everone. I tried inkscape, but then wordpress wouldn't let me upload svgs. Then I fixed that but the theme "responsive for wordlpress" still wouldn't have it. I've learned loads though, so really appreciate your input. Teodora: I'm woking on my laptop using xampp so no link yet. Your first solution seems to work fine though.
-
Vertical alignment for logo
... What I don't want is for the text to jump away from the image... Unless it does so "gracefully!" Media queries sound scary, although I could probably get my head around them eventually. Amazing how something so simple seeming can get so complicated!
-
Vertical alignment for logo
Hi Teodora, Your original code was what I was looking for, just my idea changed! I may be trying to use a sledgehammer to crack a nut here. My original idea was to use photoshop to make a logo like this: or this: I didn't notice until I changed the background that the resolution was awful. Then I read up and learned that PS is no good for this kind of thing since it uses raster(?) graphics. So it seemed better to use html and css for better resolution, especially if the screen is enlarged. What I don't want is for the text to jump away from the image. So I probably should just go with your original answer and use a fixed font size, although not sure how to keep it all together with the "stacked" version. The trouble is that as a novice, I don't have the overview of what the different options are, and experience to know which is best in a particular situation. It might well be that something like this should be done as an image, but with a different program to PS. I'm curious to know how more experienced people would go about creating this kind of logo. Sorry to ramble, and thanks again, Robin.
-
Vertical alignment for logo
Thanks for all your advice. Teodora's code works a treat, and seems like the most simple solution. The plot thickens though as I go further down the rabbit hole and try to make a simple logo work in a responsive theme. Can anyone suggest how to style this code: <div id="logo"> <img src="logo_image" alt="logo_image"> <h2>display logo text</h2> </div> so that the text automatically has the same height as the image, even when the window is resized? Also, how about this version? <div id="logo"> <img src="logo_image" alt="logo_image"> <h2>display<br>logo<br>text</h2> </div> Thanks in advance for any further advice, Robin.
-
Vertical alignment for logo
I'm not liking CSS today. Several hours later and what I imagined would be a really simple thing to do still eludes me. I want to align text vertically against an image for a logo, so even if the text is not as tall as the image, it will have the same amount of space above and below it. Here's my basic code: <html> <head> <style type="text/css"> #logo{ height:100px; width:960px; } #logo h2{ display:inline; font-size:72; color:red; text-shadow:1px 1px 2px black; padding-left:5px; } </style> </head> <body> <div id="logo"> <img src="my image" alt="image for logo"> <h2>Text to align vertically</h2> </div> </body> </html> Can someone please help? Regards, Robin.
- Control Facebook Images
-
Control Facebook Images
Aaargh! I've spend days trying to get control of how my posts appear when I paste a link into my FB status. I've learned about og meta tags, and put a link rel image_src as well as og:image. I can display the image I want, but it's too large. I've read that og images have to be at least 180x180, so I've chosen 200x200. FB shrinks this to 156x156, but I'd like it smaller - say 90x90. Anyone know how to do this? Please? Webdesign is a RABBIT HOLE!
-
Positioning on Wp site
Hi there. I want to insert a testimonial snippet below the image on the following page: http://www.robinandrews.net/devonmathstuition but I can't work out how to do it. My css skills are rather rudimentary... The markup for main content is below. Any help much appreciated. <div class="entry-content"> <p><img class="alignright size-full wp-image-18" style="width: 250px; height: 250px;" alt="Maths Tuition in Devon - Totnes, Torbay, Buckfastleigh, Newton Abbot, Marldon etc." src="http://www.robinandrews.net/devonmathstuition/wp-content/uploads/sites/2/2013/02/arithmeticimage.jpg" width="250" height="250" /></p><h4 style="display: inline;">Frazzled by Fractions?<br />Puzzled by polygons?<br />Have no fear, Robin is here!<br /></h4><h2 style="display: inline;"><ul style="margin-top: 10px;"><li>Exam preparation for SATs, GCSE, A-level <br />and 11+</li><li>Confidence building</li><li>Identifying and filling “gaps” in learning</li><li>Qualified and experienced teacher (BEd Hons)</li><li>Clear and friendly teaching style</li><li>Current CRB</li><li>Take the trauma out of learning maths!</li></ul></h2><div class="vcard" id="hcard-Robin-Andrews"><h3 style="text-align: center;"><span class="org">Devon Maths Tuition</span><br /><a class="email" href="mailto:mathstuition@robinandrews.net">email: mathstuition@robinandrews.net</a><br /><span class="tel">Tel: 07717 252766</span></h3></div>
-
needing encouragement and direction
Thanks guys. It's good to know that other people feel the same way sometimes, and I appreciate the supportive attitude of many people in the business who are willing to give their time and energy to helping others. It's interesting what you say about specialising. I think if I had to chose I'd go for coding. I've got a very long way to go, but I've made a start and I enjoy it. Regards, Robin
-
Beginners project
Hi there, I'm just learning php, and I wanted to create a simple progrm to help with doing further learning exercises - I want to create an array from user input with a specified number of elements. I got as far as the code below, then panicked beacuse I was in too many nested ifs and couldn't track what was happening. I know I need a for loop to create the input fields, and to use something like "element_name[]", but I think I've bitten off more than I can chew and would appreciate some help. Kind regards, Robin. PS I imagine that the whole approach might need tweaking.... <DOCTYPE html> <body> <h2>User generated array</h2> <!--Find out how many fields are needed and create them.--> <?php if (isset($_POST['number_of_elements'])){ $number_of_elements = htmlentities($_POST['number_of_elements']); if (!empty($number_of_elements)){ //create $number_of_elements fields echo 'Your array will have '.$number_of_elements.' elements'; if (issset($_POST['user_array'])){ $user_array=($_POST['user_array']); print_r ($user_array); } } } ?> <form action="<?php htmlentities($_SERVER['PHP_SELF']); ?>" method="POST"> <p>How many elements do you want your array to have?<input type="number" name="number_of_elements" /></p> <p><input type="submit" value="Submit" /></p> </form> </body>
-
needing encouragement and direction
Hi there, About a year ago, I didn't know what an html tag was, and hadn't heard of css. Since then, I've put my learning hat on, and come up with the following websites: www.creativecounsellingdevon.co.uk www.robinandrews.net www.robinandrews.net/devonmathstuition www.walledgardenflowersdevon.co.uk www.greendragonsuperfoods.co.uk (under construction). I've learned some php, handcoded the first one above, and learned a fair bit about wordpress, not to mention learning about ftp and photoshop among other things. However, I'm feeling a bit discouraged. I'm thinking that eventually I might like to be a professional web designer, but when I look at the quality of so many websites out there, and imagine the level of expertise involved in creating them, I feel daunted. I know I've come a long way, but it seems like so far to go before I'm producing really high quality work that ranks highly in search engines. What I'd like is a few words of encouragment. If anyone could look over my work and tell me what they think I'm doing well, that would be really helpful. On top of that, any suggestions for areas which I might want to develop would also be appreciated. What I don't want at this stage is criticism. Once I feel a bit more confident I may submit some sites for review, but my purpose here is different. I'm looking for gentle guidance and encouragement. Kind regards, Robin.
-
Strange entries in Wordpress database
I've just been looking at the contends of my WP SQL database (clean install) and found all sorts of strange things. Could someone tell me whether stuff like the following should be there, and if so, why?(WP forum not forthcoming) rom home and maintaining a distributed workforce.</p>\n<p>Web-based software, like <a href="http://wordpress.org">WordPress</a>, <a href="http://www.joomla.org">Joomla</a>, and <a href="http://drupal.org">Drupal</a>, are taking over the publishing industry and allow you to work from anywhere with an internet connection. Though, even though they can be managed  from home, working from home and maintaining a distributed workforce is not yet broadly acknowledged in society as a successful and efficient alternative to working in an office. Despite working with software that doesn’t need to be tied to one specific workstation, you could still find yourself tied to a desk in cubicle.</p>\n<p>I work full-time for <a href="http://automattic.com">Automattic</a> and have the pleasure of both working from home and setting my own hours. After all, I only need a browser, an email client, and IRC client, and <a href="http://www.skype.com/">Skype</a> to do my job. A desk is nice, but there’s no one saying that said desk has to be in the dark corner of some corporate office. As for communication between the 150 of us (130 who work from home, far away from the central “office” in San Francisco), we communicate mostly via a variety of blogs running the <a href="http://p2theme.com">P2 theme</a>. It’s as close as you can get to a water cooler or a meeting room with text, you should try it. For other communication needs, we use primarily IRC followed by Skype for less work-related chats.</p>\n<p>Do you work from home? And, if you work from home for a larger company (not just yourself), how is communication and overall efficiency maintained?</p>\n<img src="http://feeds.feedburner.com/~r/weblogtoolscollection/UXMP/~4/x7WcwEeaJQk" height="1" width="1" />";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}s:7:"pubDate";a:1:{i:0;a:5:{s:4:"data";s:31:"Tue, 12 Mar 2013 14:00:46 +0000";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}s:32:"http://purl.org/dc/elements/1.1/";a:1:{s:7:"creator";a:1:{i:0;a:5:{s:4:"data";s:5:"James";s:7:"attribs";a:0:{}s:8:"xml_base";s:0:"";s:17:"xml_base_explicit";b:0;s:8:"xml_lang";s:0:"";}}}}}i:38;a:6:{s:4:"data";s:13:"\n \n \n \n \n \n Regards, Robin
- Full screen background in WP
-
Just 2 more css rules
"About your cursor - it shows dark grey in my browsers, so either I can't see what you are referring to, or it is impossible to change, at least with CSS, as it depends on the browser." That's the problem! On most sites (including this one) the mouse pointer turns to a black cursor over unlinked text. The 2012 theme in WP somehow changes this. Are you sure it's not done by css? If so, then how else might I change it?
-
Just 2 more css rules
Thanks Teodora. I added !important to that and it finally worked. Now it's just that pesky "I" cursor - it's grey or white over unlinked text (white over actual text, and grey over spaces in text) Any suggestions, anyone?
-
Just 2 more css rules
unfortunately printscr doesn't pick up the grey cursor. It's when the mouse pointer goes over text which isn't hyperlinked, and turns into an "I" shape. My version if IE is 9. Maybe if the pages are loading fast, the grey "active link" doesn't have time to display?
-
Just 2 more css rules
...Just noticed the box around menu items doesn't appear on Google chrome, (It does on IE). The cursor still goes grey when it changes from pointer over text though.
-
Just 2 more css rules
The grey only appears under certain circumstances, which is what makes it so hard to identify the rules using google chrome developer tools: hovering over unlinked text (, and a box around menu items just after they are clicked (active link?). Thanks for pointing out the background issue - I'll look into it.
-
Just 2 more css rules
Hi Folks, I've been working on this site: walledgardenflowersdevon dot co dot uk using the WP 2012 template. There's just 2 traces of grey left: the menu items briefly after I click them, and the cursor when it hovers over text which isn't linked to anything. I've tried using developer tools to find them, but can't work out how to "catch" them, since they only appear under certain circumstances. I'd love some help finding the css rules for these two things. Kind regards, Robin.