/    Sign up×
Community /Pin to ProfileBookmark

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…

[url]http://codepen.io/anon/pen/xevli[/url]

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

[url]http://codepen.io/anon/pen/Dibfv[/url]

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

to post a comment
PHP

13 Comments(s)

Copy linkTweet thisAlerts:
@conchairtoeauthorAug 09.2014 — <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>
Copy linkTweet thisAlerts:
@ginerjmAug 10.2014 — 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.
Copy linkTweet thisAlerts:
@conchairtoeauthorAug 10.2014 — 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.
Copy linkTweet thisAlerts:
@ginerjmAug 10.2014 — So WHY didn't you show us that code?????????
Copy linkTweet thisAlerts:
@tracknutAug 10.2014 — 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.
Copy linkTweet thisAlerts:
@ginerjmAug 10.2014 — 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.
Copy linkTweet thisAlerts:
@conchairtoeauthorAug 10.2014 — 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!?!?!?!?!?
Copy linkTweet thisAlerts:
@conchairtoeauthorAug 10.2014 — ...and it works btw. thanks for the replies, even though theres nothing you could have done to help with such a ridiculous problem.
Copy linkTweet thisAlerts:
@conchairtoeauthorAug 10.2014 — PS: aptana SUCKS
Copy linkTweet thisAlerts:
@ginerjmAug 10.2014 — remove what brackets?
Copy linkTweet thisAlerts:
@conchairtoeauthorAug 10.2014 — remove what brackets?[/QUOTE]

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.
Copy linkTweet thisAlerts:
@deathshadowAug 10.2014 — 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:

&lt;!-- Latest compiled and minified CSS --&gt;
&lt;link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css"&gt;

<i> </i> &lt;!-- Optional theme --&gt;
<i> </i> &lt;link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap-theme.min.css"&gt;

<i> </i> &lt;!--jQuery CSS--&gt;
<i> </i> &lt;link rel="stylesheet" href="//code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css" /&gt;

<i> </i> &lt;!--FontAwesome--&gt;
<i> </i> &lt;link href="//maxcdn.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css" rel="stylesheet"&gt;


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:
&lt;style&gt;

<i> </i> /* Sticky footer styles
<i> </i> -------------------------------------------------- */
<i> </i> html {
<i> </i> position: relative;
<i> </i> min-height: 100%;
<i> </i> }
<i> </i> body {
<i> </i> /* Margin bottom by footer height */
<i> </i> margin-bottom: 60px;
<i> </i> }
<i> </i> .footer {
<i> </i> position: absolute;
<i> </i> bottom: 0;
<i> </i> width: 100%;
<i> </i> /* Set the fixed height of the footer here */
<i> </i> height: 60px;
<i> </i> background-color: #f5f5f5;
<i> </i> }

<i> </i> &lt;/style&gt;


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:
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:
&lt;!--jQuery: must be loaded before booststraps javascript--&gt;
&lt;script src="//code.jquery.com/jquery-1.10.2.min.js"&gt;&lt;/script&gt;

<i> </i> &lt;!--jQuery UI--&gt;
<i> </i> &lt;script src="//code.jquery.com/ui/1.10.4/jquery-ui.js"&gt;&lt;/script&gt;

<i> </i> &lt;!-- Latest compiled and minified JavaScript --&gt;
<i> </i> &lt;script src="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"&gt;&lt;/script&gt;


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.

&lt;?php
include('config/css.php');
include('config/js.php');
?&gt;


See?
×

Success!

Help @conchairtoe spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.10,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...