Wie externe CSS Datei in einer PHP Datei verlinken? |
Love
Mitglied
 

Dabei seit: 13.08.2007
Beiträge: 2.826
 |
|
Wie externe CSS Datei in einer PHP Datei verlinken? |
 |
Hey (:
Es ist glaube ich was ganz leichten & ich bin mal wieder zu doof dafür. Lacht mich ruhig aus.
Ich habe folgendes Problem: Ich baue gerade, naja ich versuche es zumindest, CuteNews in meine Homepage ein. Nach folgendem Tutorial: Klick.
Da steht jetzt folgendes:
Zitat: |
Wenn du ein externes Stylesheet verwenden möchtest (dies bietet sich an, wenn du auf deiner Website ohnehin mit CSS arbeitest), so kannst du diese *.css-Datei in der show_news.php zu Beginn (also vor dem <?php ) verlinken. |
Und genau das hatte ich gerade vor. Die show_news.php sieht so aus.
code: |
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
|
<?PHP
error_reporting (E_ALL ^ E_NOTICE);
$cutepath = __FILE__;
$cutepath = preg_replace( "'\\\show_news\.php'", "", $cutepath);
$cutepath = preg_replace( "'/show_news\.php'", "", $cutepath);
require_once("$cutepath/inc/functions.inc.php");
require_once("$cutepath/data/config.php");
// If we are showing RSS, include some need variables.
if($template == 'rss'){
include("$cutepath/data/rss_config.php");
}
//----------------------------------
// Check if we are included by PATH
//----------------------------------
if($_SERVER["HTTP_ACCEPT"] or $_SERVER["HTTP_ACCEPT_CHARSET"] or $_SERVER["HTTP_ACCEPT_ENCODING"] or $_SERVER["HTTP_CONNECTION"]){ /* do nothing */ }
elseif(eregi("show_news.php", $PHP_SELF)){
die("<h4>CuteNews has detected that you are including show_news.php using the URL to this file.<br>
This is incorrect and you must include it using the PATH to show_news.php</h4><br>Example:<br>
this is <font color=red>WRONG</font> : <?PHP include("http://yoursite.com/cutenews/show_news.php"); ?><br>
this is <font color=green>CORRECT</font>: <?PHP include("cutenews/show_news.php"); ?><br>
<br><BR>// <font size=2>if you think this message shouldn't be shown, open show_news.php and delete it from there</font>");
}
//----------------------------------
// End of the check
//----------------------------------
if(!isset($subaction) or $subaction == ""){ $subaction = $POST["subaction"]; }
if(!isset($template) or $template == "" or strtolower($template) == "default"){ require_once("$cutepath/data/Default.tpl"); }
else{
if(file_exists("$cutepath/data/${template}.tpl")){ require("$cutepath/data/${template}.tpl"); }
else{ die("Error!<br>the template <b>".htmlspecialchars($template)."</b> does not exists, note that templates are case sensetive and you must write the name exactly as it is"); }
}
// Prepare requested categories
if(eregi("[a-z]", $category)){
die("<b>Error</b>!<br>CuteNews has detected that you use \$category = "".htmlspecialchars($category).""; but you can call the categories only with their <b>ID</b> numbers and not with names<br>
example:<br><blockquote><?PHP<br>\$category = "1";<br>include("path/to/show_news.php");<br>?></blockquote>");
}
$category = preg_replace("/ /", "", $category);
$tmp_cats_arr = explode(",", $category);
foreach($tmp_cats_arr as $key=>$value){
if($value != ""){ $requested_cats[$value] = TRUE; }
}
if($archive == ""){
$news_file = "$cutepath/data/news.txt";
$comm_file = "$cutepath/data/comments.txt";
}else{
$news_file = "$cutepath/data/archives/$archive.news.arch";
$comm_file = "$cutepath/data/archives/$archive.comments.arch";
}
$allow_add_comment = FALSE;
$allow_full_story = FALSE;
$allow_active_news = FALSE;
$allow_comments = FALSE;
//<<<------------ Detarime what user want to do
if( $CN_HALT != TRUE and $static != TRUE and ($subaction == "showcomments" or $subaction == "showfull" or $subaction == "addcomment") and ((!isset($category) or $category == "") or ($requested_cats[$ucat] == TRUE ) ) ){
if($subaction == "addcomment"){ $allow_add_comment = TRUE; $allow_comments = TRUE; }
if($subaction == "showcomments"){ $allow_comments = TRUE; }
if(($subaction == "showcomments" or $allow_comments == TRUE) and $config_show_full_with_comments == "yes"){$allow_full_story = TRUE; }
if($subaction == "showfull") $allow_full_story = TRUE;
if($subaction == "showfull" and $config_show_comments_with_full == "yes") $allow_comments = TRUE;
}
else{
if($config_reverse_active == "yes"){ $reverse = TRUE; }
$allow_active_news = TRUE;
}
//----------->>> Detarime what user want to do
require("$cutepath/inc/shows.inc.php");
if($_GET['archive'] and $_GET['archive'] != ''){ $archive = $_GET['archive']; } // stupid fix ?
unset($static, $template, $requested_cats, $category, $catid, $cat,$reverse, $in_use, $archives_arr, $number, $no_prev, $no_next, $i, $showed, $prev, $used_archives);
?>
<!-- News Powered by CuteNews: http://cutephp.com/ --> |
|
Wo genau muss ich jetzt die externe CSS Datei verlinken? Da steht ja vor dem <?php. Wo genau?
Dann einfach so?
code: |
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
|
<link href="style.css" rel="stylesheet" type="text/css">
<?PHP
error_reporting (E_ALL ^ E_NOTICE);
$cutepath = __FILE__;
$cutepath = preg_replace( "'\\\show_news\.php'", "", $cutepath);
$cutepath = preg_replace( "'/show_news\.php'", "", $cutepath);
usw. |
|
Oder muss da trotzdem noch <html><head> usw. hin?
Liebe Grüße,
Nasti
|
|
24.02.2009 15:14 |
|
|
Love
Mitglied
 

Dabei seit: 13.08.2007
Beiträge: 2.826
Themenstarter
 |
|
|
24.02.2009 15:25 |
|
|
Love
Mitglied
 

Dabei seit: 13.08.2007
Beiträge: 2.826
Themenstarter
 |
|
Zitat: |
Original von Jeanny
Ja, kann man in der Regel schon. Zumindest kombiniere ich auch immer HTML mit PHP und das funktioniert einwandfrei. ;D
Allerdings habe ich mit CuteNews nicht viel am Hut, habs noch nicht ausprobiert. ;D
Was kommt denn für eine Fehlermeldung? Hab leider noch keinen Link per PN erhalten (?) |
Eine Fehlermeldung kommt nicht, nur die Schrift ist nicht so, wie sie sein sollte. Solltest jetzt eine PN haben.
Liegt vielleicht auch daran, dass ich hier (Auszug aus den Codes von CuteNews)
code: |
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
|
<div style="width:420px; margin-bottom:30px;">
<div><strong>{title}</strong></div>
<div style="text-align:justify; padding:3px; margin-top:3px; margin-bottom:5px; border-top:1px solid #D3D3D3;">{short-story}</div>
<div style="float: right;">[full-link]Read more •[/full-link] [com-link]{comments-num} Comments[/com-link]</div>
<div><em>Posted on {date} by {author}</em></div>
|
|
auch noch was hinschreiben muss? Also auch nochmal einen 'Verweis' zu der CSS Datei?
Da kann man ja bei 'Options' -> 'Templates' die Codes und so verändern.
|
|
24.02.2009 15:32 |
|
|
Love
Mitglied
 

Dabei seit: 13.08.2007
Beiträge: 2.826
Themenstarter
 |
|
Zitat: |
Original von Jeanny
PN hab ich jetzt bekommen.
Du musst die externe CSS Datei auf jeder Textseite, wo Schrift ist, neu einfügen in den <head> Bereich.
Bitte mal CSS Code geben. |
Ähm...das habe ich gemacht. Also auf den normalen Seiten (Startseite, blabla, blabla, link, link). Nur halt bei den CuteNews nicht.
Ähm, ich habs dir noch per PN geschrieben. ^^
|
|
24.02.2009 15:41 |
|
|
|
Impressum
|