Ich habe Quellcode von einem Link heruntergeladen und versuchen zu verstehen, wie sie sich miteinander verbinden. Ich bin nicht vertraut mit Web-Anwendung Tools wie HTML, CSS, JS usw., so dass ich Schwierigkeiten habe zu verstehen.Verknüpfen von HTML- und CSS-Dateien in verschiedenen Ordnern
Die Struktur Ordner
-public_html
|_index.html
|_home
|_controllers
|_HomeCtrl.js
|_views
|_home.html
|_module.js
index.html hat
<html>
<head>
<title>TODO supply a title</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<!-- Basic Styles -->
<link rel="stylesheet" type="text/css" media="screen" href="styles/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" media="screen" href="styles/css/font-awesome.min.css">
<link rel="stylesheet" type="text/css" media="screen" href="styles/fonts/line-icons/line-icons.css">
<!-- Bootstrap CSS -->
<link rel="stylesheet" type="text/css" media="screen" href="styles/css/jasny-bootstrap.min.css">
<link rel="stylesheet" type="text/css" media="screen" href="styles/css/material-kit.css">
<!-- Main Styles -->
<link rel="stylesheet" type="text/css" media="screen" href="styles/css/main.css">
<!-- custom Styles -->
<link rel="stylesheet" type="text/css" media="screen" href="styles/css/custom.css">
<!-- Responsive CSS Styles -->
<link rel="stylesheet" type="text/css" media="screen" href="styles/css/responsive.css">
<!-- Slicknav js -->
<link rel="stylesheet" type="text/css" media="screen" href="styles/css/slicknav.css">
<!-- Bootstrap Select -->
<link rel="stylesheet" type="text/css" media="screen" href="styles/css/bootstrap-select.min.css">
<link rel="shortcut icon" href="styles/img/favicon/favicon.ico" type="image/x-icon">
<link rel="apple-touch-icon" href="styles/img/splash/sptouch-icon-iphone.png">
<link rel="apple-touch-icon" sizes="76x76" href="styles/img/splash/touch-icon-ipad.png">
<link rel="apple-touch-icon" sizes="120x120" href="styles/img/splash/touch-icon-iphone-retina.png">
<link rel="apple-touch-icon" sizes="152x152" href="styles/img/splash/touch-icon-ipad-retina.png">
<!-- iOS web-app metas : hides Safari UI Components and Changes Status Bar Appearance -->
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<!-- Startup image for web apps -->
<!--
<link rel="apple-touch-startup-image" href="styles/img/splash/ipad-landscape.png" media="screen and (min-device-width: 481px) and (max-device-width: 1024px) and (orientation:landscape)">
<link rel="apple-touch-startup-image" href="styles/img/splash/ipad-portrait.png" media="screen and (min-device-width: 481px) and (max-device-width: 1024px) and (orientation:portrait)">
<link rel="apple-touch-startup-image" href="styles/img/splash/iphone.png" media="screen and (max-device-width: 320px)">
-->
</head>
<body>
<div><?php include('/app/home/views/home.html'); ?></div>
</body>
</html>
HomeCtrl.js
hat
'use strict';
angular.module('app.home').controller('HomeController', function ($scope) {
});
home.html
<!-- Start intro section -->
<section id="intro" class="section-intro">
<div class="overlay">
<div class="container">
<div class="main-text">
<h1 class="intro-title">Welcome To <span ><strong>Test</strong>Page</span></h1>
<p class="sub-title">Search for property, jobs and more</p>
<!-- Start Search box -->
<div class="row row-centered">
<div class="search-bar col-centered">
<div class="advanced-search">
<div class="row row-centered">
<div class="col-md-6 col-sm-6 col-xs-12 col-centered">
<button class="btn btn-common btn-search btn-block"><strong>Model</strong></button>
</div>
<div class="col-md-6 col-sm-6 col-xs-12 col-centered">
<button class="btn btn-common btn-search btn-block"><strong>Actress</strong></button>
</div>
</div>
<form class="search-form" method="get"></form>
</div>
<!-- </form> -->
</div>
</div>
<!-- End Search box -->
</div>
</div>
</div>
</section>
<!-- end intro section -->
<div class="wrapper">
<!-- Categories Homepage Section Start -->
<section id="categories-homepage">
<div class="container">
<div class="row">
<div class="col-md-12">
<h3 class="section-title">Browse Ads from 8 Categories</h3>
</div>
<div class="col-md-3 col-sm-6 col-xs-12">
<div class="category-box border-1 wow fadeInUpQuick" data-wow-delay="0.3s">
<div class="icon">
<a href="#"><i class="lnr lnr-store color-1"></i></a>
</div>
<div class="category-header">
<a href="#"></a>
</div>
<div class="category-content row-centered">
<div class="category-body"><h3 class="col-centered">Lady</h3></div>
</div>
</div>
</div>
<div class="col-md-3 col-sm-6 col-xs-12">
<div class="category-box border-5 wow fadeInUpQuick" data-wow-delay="1.5s">
<div class="icon">
<a href="#"><i class="lnr lnr-briefcase color-5"></i></a>
</div>
<div class="category-header">
<a href="#"></a>
</div>
<div class="category-content row-centered">
<div class="category-body"><h3 class="col-centered">Business</h3></div>
</div>
</div>
</div>
<div class="col-md-3 col-sm-6 col-xs-12">
<div class="category-box border-6 wow fadeInUpQuick" data-wow-delay="1.8s">
<div class="icon">
<a href="#"><i class="lnr lnr-graduation-hat color-6"></i></a>
</div>
<div class="category-header">
<a href="#"></a>
</div>
<div class="category-content row-centered">
<div class="category-body"><h3 class="col-centered">Men</h3></div>
</div>
</div>
</div>
<div class="col-md-3 col-sm-6 col-xs-12">
<div class="category-box border-7 wow fadeInUpQuick" data-wow-delay="2.1s">
<div class="icon">
<a href="#"><i class="lnr lnr-apartment color-7"></i></a>
</div>
<div class="category-header">
<a href="#"></a>
</div>
<div class="category-content row-centered">
<div class="category-body"><h3 class="col-centered">Kids</h3></div>
</div>
</div>
</div>
<div class="col-md-3 col-sm-6 col-xs-12">
<div class="category-box border-8 wow fadeInUpQuick" data-wow-delay="2.3s">
<div class="icon">
<a href="#"><i class="lnr lnr-car color-8"></i></a>
</div>
<div class="category-header">
<a href="#"></a>
</div>
<div class="category-content row-centered">
<div class="category-body"><h3 class="col-centered">Travel</h3></div>
</div>
</div>
</div>
<div class="col-md-3 col-sm-6 col-xs-12">
<div class="category-box border-2 wow fadeInUpQuick" data-wow-delay="0.6s">
<div class="icon">
<a href="#"><i class="fa fa-laptop fa-5x color-2" aria-hidden="true"></i></a>
</div>
<div class="category-header">
<a href="#"></a>
</div>
<div class="category-content row-centered">
<div class="category-body"><h3 class="col-centered">Actors</h3></div>
</div>
</div>
</div>
<div class="col-md-3 col-sm-6 col-xs-12">
<div class="category-box border-4 wow fadeInUpQuick" data-wow-delay="1.2s">
<div class="icon">
<a href="#"><i class="lnr lnr-cart color-4"></i></a>
</div>
<div class="category-header">
<a href="#"></a>
</div>
<div class="category-content row-centered">
<div class="category-body"><h3 class="col-centered">Shopping</h3></div>
</div>
</div>
</div>
<div class="col-md-3 col-sm-6 col-xs-12">
<div class="category-box border-3 wow fadeInUpQuick" data-wow-delay="0.9s">
<div class="icon">
<a href="#"><i class="lnr lnr-cog color-3"></i></a>
</div>
<div class="category-header ">
<a href="#"></a>
</div>
<div class="category-content row-centered">
<div class="category-body"><h3 class="col-centered">Services</h3></div>
</div>
</div>
</div>
</div>
</div>
</section>
<!-- Categories Homepage Section End -->
</div>
<!-- Counter Section Start -->
<section id="counter">
<div class="container">
<div class="row">
<div class="col-md-3 col-sm-6 col-xs-12">
<div class="counting wow fadeInDownQuick" data-wow-delay=".5s">
<div class="icon">
<span>
<i class="lnr lnr-tag"></i>
</span>
</div>
<div class="desc">
<h3 class="counter">12090</h3>
<p>Regular Ads</p>
</div>
</div>
</div>
<div class="col-md-3 col-sm-6 col-xs-12">
<div class="counting wow fadeInDownQuick" data-wow-delay="1s">
<div class="icon">
<span>
<i class="lnr lnr-map"></i>
</span>
</div>
<div class="desc">
<h3 class="counter">350</h3>
<p>Locations</p>
</div>
</div>
</div>
<div class="col-md-3 col-sm-6 col-xs-12">
<div class="counting wow fadeInDownQuick" data-wow-delay="1.5s">
<div class="icon">
<span>
<i class="lnr lnr-users"></i>
</span>
</div>
<div class="desc">
<h3 class="counter">23453</h3>
<p>Reguler Members</p>
</div>
</div>
</div>
<div class="col-md-3 col-sm-6 col-xs-12">
<div class="counting wow fadeInDownQuick" data-wow-delay="2s">
<div class="icon">
<span>
<i class="lnr lnr-license"></i>
</span>
</div>
<div class="desc">
<h3 class="counter">150</h3>
<p>Premium Ads</p>
</div>
</div>
</div>
</div>
</div>
</section>
<!-- Counter Section End -->
module.js hat
"use strict";
angular.module('app.home', ['ui.router'])
.config(function ($stateProvider) {
$stateProvider
.state('app.home', {
url: '/home',
data: {
title: 'Blank'
},
views: {
"[email protected]": {
templateUrl: 'app/home/views/home.html',
controller: 'HomeController'
}
}
})
});
Wenn ich kopieren und beinhalten alle Inhalte von home.html in Körper in index.html, kann ich die Homepage sehen. Aber ich möchte nur den Dateinamen unter Verwendung Ich habe versucht, als <div><?php include(/home/views/home.html); ?></div>
aufzunehmen, aber nichts kommt heraus.
Kann mir jemand erklären
(1) Was ist der Vorteil der Aufspaltung Ordner als Controller und Ansichten innen nach Hause?
(2) Was sind die Zwecke dieser js-Dateien, HomeCtrl.js und module.js?
(3) Wie home.html von index.html aufrufen?
Dank
EDIT1: Ich habe eine andere Datei app.js
und es hat
'use strict';
/**
* @ngdoc overview
* @name app [smartadminApp]
* @description
* # app [smartadminApp]
*
* Main module of the application.
*/
var app = angular.module('app', [
'ngSanitize',
'ngAnimate',
'restangular',
'ui.router',
'ui.bootstrap',
// Smartadmin Angular Common Module
'SmartAdmin',
// App
'app.auth',
'app.layout',
'app.consumers',
//'app.chat',
//'app.dashboard',
//'app.calendar',
//'app.inbox',
//'app.graphs',
//'app.tables',
//'app.forms',
//'app.ui',
//'app.widgets',
//'app.maps',
//'app.appViews',
//'app.misc',
//'app.smartAdmin',
//'app.eCommerce'
'app.home'
])
.config(function ($provide, $httpProvider, RestangularProvider) {
// Intercept http calls.
$provide.factory('ErrorHttpInterceptor', function ($q) {
var errorCounter = 0;
function notifyError(rejection) {
console.log(rejection);
$.bigBox({
title: rejection.status + ' ' + rejection.statusText,
content: rejection.data,
color: "#C46A69",
icon: "fa fa-warning shake animated",
number: ++errorCounter,
timeout: 6000
});
}
return {
// On request failure
requestError: function (rejection) {
// show notification
notifyError(rejection);
// Return the promise rejection.
return $q.reject(rejection);
},
// On response failure
responseError: function (rejection) {
// show notification
notifyError(rejection);
// Return the promise rejection.
return $q.reject(rejection);
}
};
});
// Add the interceptor to the $httpProvider.
$httpProvider.interceptors.push('ErrorHttpInterceptor');
RestangularProvider.setBaseUrl(location.pathname.replace(/[^\/]+?$/, ''));
})
.constant('APP_CONFIG', window.appConfig)
.run(function ($rootScope
, $state, $stateParams) {
$rootScope.$state = $state;
$rootScope.$stateParams = $stateParams;
// editableOptions.theme = 'bs3';
});
var httpApiConfig = {
headers: {
'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8;',
headers: { 'Content-Type': 'application/json' },
}
};
app.constant('httpApiConfig', httpApiConfig)
Dies ist Webapp basiert auf angularjs 1.x. Ich schlage vor, die Dokumentation für Antworten zu lesen: (https://angularjs.org/). Wie für alle Ordner im Code - es ist eine allgemein gute Methode, eine Struktur in Ihrem Quellcode zu haben, wenn die Projektcodebasis über einer bestimmten Größe liegt. Wie Sie Ihr Projekt strukturieren, liegt * fast * bei Ihnen. (fast, weil einige der Werkzeuge, die verwendet werden, um die verkleinerte Anwendung oder CSS zu erzeugen, wenn sie verwendet werden, eine bestimmte Ordnerstruktur erwarten können). –
https://www.tutorialspoint.com/mvc_framework/mvc_framework_introduction.htm –
Wenn Sie Probleme haben, 'home.html' zu verbinden, könnten Sie versuchen, Php echo getcwd(); ?> ', um das aktuelle Arbeitsverzeichnis zu erhalten. –