www.webdeveloper.com
Results 1 to 14 of 14

Thread: most ridiculous problem as usual ... please help.

  1. #1
    Join Date
    Jul 2014
    Posts
    42

    most ridiculous problem as usual ... please help.

    Ok so clearly I don't know how to do the basic function of linking php files to html ones. heres my problem...

    http://codepen.io/anon/pen/xevli

    yet it works fine if i put it in the head...

    http://codepen.io/anon/pen/Dibfv

    I thought to link a php file it include('config/css.php');

    i put everything in a config folder which is in the same folder as the index file.

    thanks

  2. #2
    Join Date
    Jul 2014
    Posts
    42
    <a href="http://s1379.photobucket.com/user/conchairtoe/media/code_zps617601a9.jpg.html" target="_blank"><img src="http://i1379.photobucket.com/albums/ah126/conchairtoe/code_zps617601a9.jpg" border="0" alt=" photo code_zps617601a9.jpg"/></a>

  3. #3
    Join Date
    Jul 2014
    Posts
    42
    oh ffs i can't even post a damn photo lol

    http://i1379.photobucket.com/albums/...ps617601a9.jpg

  4. #4
    Join Date
    Jul 2013
    Location
    Voorheesville NY USA
    Posts
    780
    Huh??? Your first post made little sense at all to me. But then you added two more posts that make no sense at all and do not seem to be even remotely related to your first.
    JG
    PS - If you're posting here you should be using:

    error_reporting(E_ALL | E_NOTICE);
    ini_set('display_errors', '1');


    at the top of ALL php code while you develop it!

  5. #5
    Join Date
    Jul 2014
    Posts
    42
    Ok, sorry.

    What I'm trying to do is link a php file to the html file. The php files are css.php which contains the bootstrap css, and sticky footer css, and the js.php file, which has the javascript (i guess? I really don't know as i'm simply following along step by step with a tutorial, and I've literally done everything the exact same as they're doing it).

    When I leave all the css and js in the HEAD of the main html document, it works fine, but when I move it to the external files (css.php and js.php) and use the include function within php tags on the html document, it fails to work!

    does that make sense?

    I already know the problem is something ridiculously simple and I'm just to noobtarded to notice it.

  6. #6
    Join Date
    Jul 2013
    Location
    Voorheesville NY USA
    Posts
    780
    So WHY didn't you show us that code?????????
    JG
    PS - If you're posting here you should be using:

    error_reporting(E_ALL | E_NOTICE);
    ini_set('display_errors', '1');


    at the top of ALL php code while you develop it!

  7. #7
    Join Date
    Aug 2006
    Posts
    1,917
    It would be hugely rare to be providing your css and js via php. I suppose you might be doing that, but I seriously doubt it. You most likely want to include them the way you originally did - via html. Of course that might not accomplish the goal of the tutorial you're following.

  8. #8
    Join Date
    Jul 2013
    Location
    Voorheesville NY USA
    Posts
    780
    Providing the css or js via php is completely normal imho. As part of your html output (via echo/heredocs or simply lines outside of the php tags, an include of external css or js files (or a script or style tag) makes perfect sense. Personally I like using include which allows me to use files outside the web tree.
    JG
    PS - If you're posting here you should be using:

    error_reporting(E_ALL | E_NOTICE);
    ini_set('display_errors', '1');


    at the top of ALL php code while you develop it!

  9. #9
    Join Date
    Jul 2014
    Posts
    42
    ok so as i predicted, it was the MOST retarded problem. FOR WHATEVER REASON in the video, the fella uses include('file'); and it works fine, but for me, i had to remove the brackets.... WHY!?!?!?!?!?

  10. #10
    Join Date
    Jul 2014
    Posts
    42
    ...and it works btw. thanks for the replies, even though theres nothing you could have done to help with such a ridiculous problem.

  11. #11
    Join Date
    Jul 2014
    Posts
    42
    PS: aptana SUCKS

  12. #12
    Join Date
    Jul 2013
    Location
    Voorheesville NY USA
    Posts
    780
    remove what brackets?
    JG
    PS - If you're posting here you should be using:

    error_reporting(E_ALL | E_NOTICE);
    ini_set('display_errors', '1');


    at the top of ALL php code while you develop it!

  13. #13
    Join Date
    Jul 2014
    Posts
    42
    Quote Originally Posted by ginerjm View Post
    remove what brackets?
    If u click the codepen link you should see in the head the php include function.
    In the tutorial the guy had brackets, which was causing it to work fine for him but not for me.

  14. #14
    Join Date
    May 2014
    Posts
    1,017
    This might sound odd... or insulting... but really you might want to learn how to use codepen before blindly pasting code into it.

    The way you have written your code, ALL of it belongs in the right-most text are. The center box is for RAW CSS, aka without the HTML around it. The right box is for RAW JS, without the markup around it.

    As such when assembled it's turning into gibberish.

    See how you have in the center box:

    Code:
     		<!-- Latest compiled and minified CSS -->
    		<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
    		
    		<!-- Optional theme -->
    		<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap-theme.min.css">
    		
    		<!--jQuery CSS-->
    		<link rel="stylesheet" href="//code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css" />
    		
    		<!--FontAwesome-->
    		<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css" rel="stylesheet">
    That's MARKUP, link tags, HTML... THAT IS NOT CSS so it' doesn't go there! Those are HTML links TO CSS.

    See where you have:
    Code:
    <style>
    	
    			/* Sticky footer styles
    			-------------------------------------------------- */
    			html {
    			  position: relative;
    			  min-height: 100%;
    			}
    			body {
    			  /* Margin bottom by footer height */
    			  margin-bottom: 60px;
    			}
    			.footer {
    			  position: absolute;
    			  bottom: 0;
    			  width: 100%;
    			  /* Set the fixed height of the footer here */
    			  height: 60px;
    			  background-color: #f5f5f5;
    			}
    			
    		</style>
    What's inside those style tags IS CSS, but in the CSS box on codepen you would ONLY have the CSS, just like you would in an external CSS file.

    Oh, and don't trust margin-bottom on body, it does strange things. Use padding instead.

    So the ONLY thing that belongs in the center box on codepen is:
    Code:
    html {
    	position: relative;
    	min-height: 100%;
    }
    body {
    	/* Margin bottom by footer height */
    	margin-bottom: 60px;
    }
    .footer {
    	position: absolute;
    	bottom: 0;
    	width: 100%;
    	/* Set the fixed height of the footer here */
    	height: 60px;
    	background-color: #f5f5f5;
    }
    THAT'S IT. you don't put HTML there! Same goes for your scripting. This:
    Code:
    	<!--jQuery: must be loaded before booststraps javascript-->
    		<script src="//code.jquery.com/jquery-1.10.2.min.js"></script>
    		
    		<!--jQuery UI-->
    		<script src="//code.jquery.com/ui/1.10.4/jquery-ui.js"></script>
    		
    		<!-- Latest compiled and minified JavaScript -->
    		<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
    contains NO JavaScript, that is HTML linking TO JavaScript.

    Really though that's why I advise against rubbish like online editors/previewers and just work in a proper flat text editor testing in actual browsers. You want to share, get a hosting account somewhere and put it there.

    As to PHP, codepen doesn't support PHP so I've no clue what you're expecting there... though:

    <?phpinclude('config/css.php');?>
    <?phpinclude('config/js.php');?>

    Do we SEE a problem here? No spaces.
    <?php include('config/css.php'); ?>
    <?php include('config/js.php'); ?>

    phpinclude is NOT all one word. <?php opens PHP, which you then are using the 'include' command. Two separate things! That's why for clarity sake even if it's a few extra characters, I like to split things into multiple lines.... AND it means if you are doing a bunch of PHP in a row, you don't have to open and close it every blasted line.

    Code:
    <?php
    	include('config/css.php');
    	include('config/js.php');
    ?>
    See?
    Last edited by deathshadow; 08-10-2014 at 02:41 AM.
    Java is to JavaScript as Ham is to Hamburger.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles