Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

gadgetgirl

Privileged
  • Joined

  • Last visited

Reputation Activity

  1. Like
    gadgetgirl got a reaction from Precise Estimating Ltd in PHP to echo out files as files   
    The reason you're not getting the error on line 116 anymore is because I fixed your code but you haven't sorted the single/double quotes. Single quotes displays everything literally, double quotes substitutes the value in place of the variable.
     
    echo '$thumbs'; will output $thumbs
    echo "$thumbs"; will output thumbnails
     
    Use the code I supplied, run it in your browser and look at the source code. If the images don't appear its because your file structure is in error.
     
    Do you really need the paragraphs because there's alot wrong with that bit of code. If you do need it, learn about arrays and offsets and how to access individual elements in an array.
  2. Like
    gadgetgirl got a reaction from jamiemcuk in Help with Php Signup Form!?   
    The tutorial referenced is a decent starting place to give you an overview of what is required to process a form, validate the data, insert to a d/b and send an email but it is nearly 4 years old and using deprecated functions.
     
    First and foremost - don't use the mysql functions, PHP 5.5 is now out and soon mysql functions will not be supported. Learn the mysqli extension or even better learn the PDO class. Since you're new to this, you might as well learn techniques which have a future.
     
    Secondly, look up PHP's filter functions for validation. They are more secure and make validation easy, particularly email addresses and urls. You can find these functions and a lot more in the php manual. If you have any specific questions on any of these functions, post them here.
  3. Like
    gadgetgirl got a reaction from Ampersandwich in PHP - News article page info grab from template?   
    You need a way to programmatically let news.php know which article to display. One way is to append the id of the particular article in the url e.g. news.php?id=1. news.php can access the id via $_GET. How/where will your site do this?
     
    Setting up and accessing a database is not difficult but will require a little learning. If you data is complicated designing the d/b can be challenging but if you just require a table for your articles, it is straightforward. The alternative is to learn the php functions to get and retrieve data from another file.
     
    Finally if you want nice urls like news.php/article1 as opposed to urls like news.php?id=1, you will need to include some mod_rewrite rules in your .htaccess file. Again this is not too difficult but will require some more learning.
     
     
  4. Like
    gadgetgirl got a reaction from Nillervision in PHP - News article page info grab from template?   
    if I understand what you are trying to do, you basically need to code up your own template and insert the article. Will you be storing your articles in a database? Your news.php script will be structured something like this
    <?php include('header.html'); include('sidebar.html'); //get article from database // display article include('footer.html'); ?> If you have a list of article titles on another page and you want to link to the full article, your a tag should reference the above page along with the id of the article.
    <h2>Recent Articles</h2> <ul> <li><a href="news.php?id=1">Title of Article 1</a></li> <li><a href="news.php?id=2">Title of Article 2</a></li> <li><a href="news.php?id=3">Title of Article 3</a></li> </ul> At the top of news.php you will access the id of the article using the $_GET global.
    $id = (isset($_GET['id']) && ctype_digit($_GET['id'])) ? $_GET['id'] : false; This is a ternary statement which is a succinct if else statement made up of the following 3 parts:
    (isset($_GET['id']) && ctype_digit($_GET['id'])) says if $_GET['id'] exists and is of type integer; ? $_GET['id'] says if the if statement is true set $id equal to $_GET['id']; : false - is the else part of the if statement - if the if statement is false set $id equal to false; news.php can then check if $id is false and do some error processing otherwise get the article from the database using $id
  5. Like
    gadgetgirl got a reaction from Ampersandwich in baseURL - php include code from seperate document   
    One way is to have a config file (config.inc.php) that is included by all scripts that will define all your helper functions and site constants. In that file define your base url and base uri constants
    define ('BASE_URI', '/home/example/'); //remote path to root folder define ('BASE_URL', 'http://www.example.com/'); //live url //define ('BASE_URI', '/Applications/MAMP/htdocs/example/'); //local path to root folder //define ('BASE_URL', 'localhost/example/');//local url Then your include can be something like
    include(BASE_URI . 'assets/subbar.php'); Be sure to comment / uncomment out the 2 lines depending on whether you're working locally or remotely
  6. Like
    gadgetgirl got a reaction from lcot in baseURL - php include code from seperate document   
    One way is to have a config file (config.inc.php) that is included by all scripts that will define all your helper functions and site constants. In that file define your base url and base uri constants
    define ('BASE_URI', '/home/example/'); //remote path to root folder define ('BASE_URL', 'http://www.example.com/'); //live url //define ('BASE_URI', '/Applications/MAMP/htdocs/example/'); //local path to root folder //define ('BASE_URL', 'localhost/example/');//local url Then your include can be something like
    include(BASE_URI . 'assets/subbar.php'); Be sure to comment / uncomment out the 2 lines depending on whether you're working locally or remotely
  7. Like
    gadgetgirl got a reaction from lcot in Contact form php script build.. help?   
    You really want to do some validation on the form data. Look up php's filter_var - it makes validating email addresses easy. You will also want to ensure that your required fields are filled in, do some anti-spam processing and display helpful error messages. Look up htmlspecialchars() and strip_tags().
     
    As coded, you won't get the expected results because you've used $_POST['email'] and $_POST['email_address']. $_POST['email'] will never exist the way you've coded your form.
     
    One other thing, its bad form to use uppercase for variables.
  8. Like
    gadgetgirl got a reaction from James Husband in Help with code..   
    Since you haven't used curly braces, php will only execute the first statement. Try this
    $files = glob("images/assets/*.{png,jpg,jpeg}", GLOB_BRACE); $i = 1; foreach ($files as $file) { echo "<li id:\"S-$i\"><img class=\"zuper\" src=\"$file\" /></li>"; $i++; }  
  9. Like
    gadgetgirl got a reaction from lcot in php html template called to page - navbar query   
    Before you start coding you might want to mark up on a piece of paper the aspects of the page that are common to every page, for example Header, Footer and Sidebar. Create 3 files called header.html, footer.html and sidebar.html and insert the relevant code. In each page file you include the template file with the include function:
    include('views/header.html'); I usually put these files in a different folder so be sure to specify the full path. Your full page will look something like this
     
    <?php $page = 'index'; include ('views/header.html'); ?> <div class="some_class"> blah blah blah <p>ipsem lorem</p> </div> <?php include ('views/sidebar.html'); ?> <div class="another_class"> blah blah blah <p>more text</p> </div> <?php include ('views/footer.html'); ?> You can switch between php and html by using the php tags when you want to do some php coding.
     
    You will notice that I included a $page variable in the header file. This is to answer your second question. Set that variable in every page before you include the file that displays the navigation. Then when displaying the aspect that you want to have an 'active' class, check the variable first. One way to do navigation is to create an array of nav items and then loop through the array.
    $nav_items = array('index'=>'Home', 'events'=>'Events' ); foreach ($nav_items as $nav_href=>$nav_title) { if ($page == $nav_href) { echo '<li class="active">' . $nav_title . '</li>'; } else { echo '<li>' . $nav_title . '</li>'; } } Because you have a submenu you will need to have an if statement to cater for that. You should be able to fit that into the above skeleton code. Also with the above, be sure to get your use of single and double quotes correct.
     
    There are other ways to achieve the active class situation you're after including setting an id on each page's body tag but I find the above easy.
  10. Like
    So i see this posted over and over again by users wondering how to fix the PHP warning Warning: Cannot modify header information headers already sent . So I am going to list the known causes of this warning and any other member feel free to add onto the list if i missed anything.
     
     
    Known Causes/How to fix
     
    Having HTML output/Php echos before calling header('Location:page.html');(Call the redirect before any output or turn on output buffering) Having white space before calling session_start() can result in headers already sent warning(Remove any white space before calling session_start also note session_start must be called before any output at the top of a page) Having HTML output/Php echos before calling setcookie()(Only set cookies before any other output)  
    these are just the main 3 I can think of off the top of my head and most the time the 3 I have listed are the cause more often then not. But feel free to reply and add to the list.
  11. Like
    gadgetgirl got a reaction from Lyndsey in how to customize the search results ?   
    while($runrows = mysql_fetch_assoc($getquery)) { $title = $runrows ['title']; $desc = $runrows ['description']; $url = $runrows ['url']; echo " <a href='$url'><b>$title</b></a><br> $desc<br> <a href='$url'>$url</a><p> "; } The above code is outputting the results of the search. How's your html and css knowledge. You want to wrap the above in some html tags with css classes which you can style to your requirements.
     
    echo '<div class="search_results">'; while($runrows = mysql_fetch_assoc($getquery)) { $title = $runrows ['title']; $desc = $runrows ['description']; $url = $runrows ['url']; echo " <a href='$url'><h2 class="search_title">$title</h2></a> //use a heading tag instead of b tag, its better markup <p class="search_desc">$desc</p> //p tag instead of br, same as above <a href='$url'>$url</a> //removed what looks like a stray p tag "; } echo '</div>'; Is this for a new site? The tutorial is using outdated code and if you implement this, you may find you'll have some problems in the future. Look for a tutorial that uses mysqli functions instead of mysql functions to interact with the d/b.
  12. Like
    gadgetgirl got a reaction from zombie_smoothie960 in how to customize the search results ?   
    while($runrows = mysql_fetch_assoc($getquery)) { $title = $runrows ['title']; $desc = $runrows ['description']; $url = $runrows ['url']; echo " <a href='$url'><b>$title</b></a><br> $desc<br> <a href='$url'>$url</a><p> "; } The above code is outputting the results of the search. How's your html and css knowledge. You want to wrap the above in some html tags with css classes which you can style to your requirements.
     
    echo '<div class="search_results">'; while($runrows = mysql_fetch_assoc($getquery)) { $title = $runrows ['title']; $desc = $runrows ['description']; $url = $runrows ['url']; echo " <a href='$url'><h2 class="search_title">$title</h2></a> //use a heading tag instead of b tag, its better markup <p class="search_desc">$desc</p> //p tag instead of br, same as above <a href='$url'>$url</a> //removed what looks like a stray p tag "; } echo '</div>'; Is this for a new site? The tutorial is using outdated code and if you implement this, you may find you'll have some problems in the future. Look for a tutorial that uses mysqli functions instead of mysql functions to interact with the d/b.
  13. Like
    gadgetgirl got a reaction from Ampersandwich in Counting Groups in Groups (PHP)   
    I'm not sure I understand what you're trying to do. What about something like
    <? $sqlmenu = "SELECT * FROM data_subjects WHERE active=1 ORDER by name ASC"; $resultmenu = mysql_query($sqlmenu); while($rowmenu = mysql_fetch_array($resultmenu)) { $subjectctid = $rowmenu['ID']; $sqlmodct = "SELECT * FROM data_modules WHERE active=1 AND subject = $subjectctid"; $resultmodct = mysql_query($sqlmodct); $resultmodct_num = mysql_num_rows($resultmodct); $sqlunitct = "SELECT COUNT(*) FROM data_units WHERE modules=$resultmodct['id']"; $resultunitct = mysql_query($sqlunitct); $num_units = mysql_fetch_row($resultunitct) { ?> <h2><? echo $rowmenu['name']; ?></h2> <p>Modules: <? echo $resultmodct_num; ?></p> <p>Units: <?php echo $num_units[0]; ?></p> <? } } mysql_free_result($resultmenu); ?> As an aside, the code you are using is outdated. Newer versions of php require that you use the full php tags and you will want to update your database interactions with the mysqli extension or the PDO class.
  14. Like
    gadgetgirl got a reaction from Row in Query help   
    Actually maybe its a little simpler - try this subquery (I haven't actually tried it yet )
     
    SELECT * FROM categories WHERE id NOT IN ( SELECT topcat FROM categories )  
  15. Like
    gadgetgirl reacted to Jo 90 in New moderators on WDF   
    Hi

    It's my pleasure to announce the promotion of 3 very well established and recognised members here on the forum. Their contributions and helpfulness have been absolutely fanastic over the past few months, so to myself and the other mods here were obvous choices to help moderate the forums here

    Please welcome 4li4s, Lyndsey & Teodora to the moderating staff.
     

    :yahoo:
  16. Like
    gadgetgirl reacted to webdeveloper93 in Simple PHP Search Script   
    this script has alot of security issues and id suggest researching full text searching its alot more accurate then using like
  17. Like
    How much traffic are you/the client anticipating? You need to know this to decide whether you need to scale vertically, horizontally or perhaps both (http://www.rackspace.com/blog/scaling-for-the-holidays-part-1-to-scale-vertically-or-horizontally/).
     
    Im handling a similar site that's going live tomorrow, it's expected huge traffic. Ive tested to 20,000 users so far and it's not even blinked (https://www.blitz.io/).
  18. Like
    gadgetgirl reacted to BrowserBugs in sitemap questions   
    Hi gadgetgirl.
     
    No the sitemap is normally fine, webmaster tools will say if there is a read issue, the only theory cap size is around the 50,000 page count per sitemap. It will take time to get 100% of the sitemap into the indexed pages list. I would advise against including the custom 404 page, it's not ideal to index it (but someone else step in if i'm wrong on this). As to pick ups and drop off of indexed pages it can be for various reasons. If the sitemap is read ok then just play the waiting game and watch the 'html imporvements' section for duplicate stuff.
  19. Like
    gadgetgirl got a reaction from DavidAndrewReilly in Email Form Hell   
    There are a couple of errors I can see right off the bat:
    $last_name = $_POST['email']; // required This line sets a $last_name variable to the value that is entered in the email input field - do you really want to do that?
    $email_message .= "name: ".clean_string($name)."\n"; You're probably getting a few Call to Undefined Function errors. clean_string() is a user defined function which is not included in your php script. You need to create that function or use another method to secure your data. Look up strip_tags().
     
    Also using preg_match to validate strings is not very efficient. For name and message you just want to make sure something is entered(if requried) and sanitise it with a few php functions.
  20. Like
    gadgetgirl got a reaction from DavidAndrewReilly in Email Form Hell   
    The names of your input fields are how you access them via $_POST. In your php file you use $_POST['email'], $_POST['name'] etc. but in your form you have named them input1, input2 etc.
     
    You need to change your input fields to ensure the name value equals what you are referencing via $_POST e.g.
    <input type="text" value="" class="input" name="name"> <input type="text" value="" class="input" name="email"> <textarea name="message"> Also you really need to do some sanitisation on these fields before sending them - you are opening yourself up to some security issues and ALOT of spam.
  21. Like
    gadgetgirl got a reaction from Wilha in Let Users create a Topic   
    You will need to learn a database and a server side language - php and mysql are open source so there are lots of free online resources to learn them. For video tutorials, you can try phpacademy, lynda.com, codeacademy, sitepoint or there are others. If you prefer reading, I would recommend PHP and MYSQL for Dynamic Websites by Larry Ullman. There is a good support forum and I think it includes a mini forum example which is basically what you are trying to achieve.
  22. Like
    gadgetgirl got a reaction from webcanvasdesign in theme control panel   
    Ok there are several steps and I've simplified the process. I've used sessions to allow the chosen stylesheet to be accessed by all the pages. Knowing javascript you'll be familiar with sessions. Look in the php manual for the syntax - the main thing is to ensure you start the session with session_start() as the absolute first thing on pages that use the $_SESSION variable. If not, you will get an error.
     
    1. In your configuration or functions file define the function
    function set_stylesheet($colour) { $styles_file=array('blue'=>'blueStyles.css', 'red'=>'redStyles.css', 'green'=>'greenStyles.css'); return $styles_file[$colour]; } 2. In your html page, you can have a mini form to allow the user to select the colour. The form action will call the set_stylesheet function and store it in a session. e.g.
    <?php session_start() ?> <!DOCTYPE html> <head> ... </head> <body> $colours = array('blue', 'red', 'green'); if (isset($_POST['colour']) && in_array($_POST['colour'],$colours)) { $_SESSION['stylesheet'] = set_stylesheet($_POST['colour']); } ?> <form action="" method="post"> <select name="colour"> <?php foreach ($colours as $colour) { echo '<option value="' . $colour . '">' . $colour . '</option>'; } ?> <input type="submit" value="Choose colour" /> </select> </form> 3. The head section of your pages will access the session variable to pull in the appropriate stylesheet.
    <?php session_start() ?> <!DOCTYPE html> ... <head> if ($_SESSION['stylesheet']) { echo '<link href="' . $_SESSION['stylesheet'] . '" rel="stylesheet" type="text/css"/>'; } else { echo '<link href="default.css" rel="stylesheet" type="text/css"/>'; } ?> </head>  
    I have limited experience working with cms sites so you will need to alter the above to suit your cms. And for themes you might want to store the value in a configurations table rather than a session. Hope this helps.
  23. Like
    gadgetgirl got a reaction from webcanvasdesign in theme control panel   
    I've not done this before and I mostly handcode - you can store the variables/options in an array or a database. Depending on the option entered, you could pull in a different css file. Using an array would be faster.
     
    Set up a configurations file, which every page includes. In the configurations file you can create a function that will define the array of options and actions and return to the calling page which action (or stylesheet) to pull in. When you call the function be sure to do so with a variable assignment statement to have access to the returned variable. Let me know if you need an example.
  24. Like
    gadgetgirl got a reaction from ramo55 in can i do this?   
    Assuming you know php, this is easily accomplished.
     
    3: the users selection is stored - set up the link so that the url to the linked page includes the id of the image e.g.
    <a href="example.php?imageId=x"> <img src="imagefile.ext" /></a>  
    4: the user is taken to the next page, where he must enter some details such as email and name etc... - in example.php have a form which reads in the image id which will be stored in $_GET; display and validate a form with the user details you require.

    5: this info is sent to my email and then the user is taken to a thank you page - example.php should email the form data and redirect the user to the thank you page if the form data passes validation checks.
  25. Like
    gadgetgirl got a reaction from teodora in can i do this?   
    Assuming you know php, this is easily accomplished.
     
    3: the users selection is stored - set up the link so that the url to the linked page includes the id of the image e.g.
    <a href="example.php?imageId=x"> <img src="imagefile.ext" /></a>  
    4: the user is taken to the next page, where he must enter some details such as email and name etc... - in example.php have a form which reads in the image id which will be stored in $_GET; display and validate a form with the user details you require.

    5: this info is sent to my email and then the user is taken to a thank you page - example.php should email the form data and redirect the user to the thank you page if the form data passes validation checks.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.