I want to make a kind of forum with php (pdo) now I can get the data out of the database like you can see with the 2 items in the picture down below (de 2 dots with text) now I want the <H5> tagg to be the things on the dots but I have no clue how to do that.
What I want
<div class="col-md-6">
<div class="well dash-box">
<h2><span class="glyphicon glyphicon-stats" aria-hidden="true"></span> Inspiratie</h2>
<h5>Tips en inspiratie om jou en je business een boost te geven, dit kan van groot belang zijn.</h5>
</div>
</div>
<div class="col-md-6">
<div class="well dash-box">
<h2><span class="glyphicon glyphicon-list-alt" aria-hidden="true"></span> 12</h2>
<h5> hoi</h5>
<?php
$toppics = $app->get_topics();
$i = 4;
foreach ($toppics as $topic) {
echo '<li>' . $topic['onderwerp'] . '</li>';
}
?>
</div>
</div>
It takes the column "onderwerp" out of the database and I want those to be the <H5>tags
Related
Hello I am working with laravel and livewire and I'm trying to resolve this error for a chat room, can anyone help me please? :
Illuminate\Contracts\Container\BindingResolutionException Unable to
resolve dependency [Parameter #0 [ $message ]] in class
App\Http\Livewire\ChatRoom
this is the concerned function in LettresController.php
public function ChoisirLettresAléatoiresDuReserve(){
// Messages de la btcom
$message=Message::all();
$user_id = auth()->id();
// check if there is game in the request
if (!request()->has('game')) {
return redirect()->route('game.select');
}
// getting game ID and fetching game
$game = $this->get_game_by_id((int)request()->get('game'));
// check if the game has finished or is still running
if ($this->check_game_finished($game)) {
$this->update_game_timer($game, $user_id);
// user has used up his chevalet, so we need to update with new
$position = $this->user_chevalet_position($game, $user_id);
if ($position === null) {
// user might have entered a game id but was never part of the game
return redirect()->route('game.select');
}
// get if the player has no more playing piece left
$user_chevalet = $this->get_user_chevalet($game, $user_id, $position);
$valeur = $this->generate_valeur($user_chevalet);
$game = $this->get_game_by_id((int)request()->get('game'));
return view('jeu')->with(compact('game', 'valeur', 'position','message'));
}
return redirect()->route('game.ended')->with(['Resultat' => 'Game Ended']);
}
and I am using livewire
livewire.ChatRoom.php
<?php
namespace App\Http\Livewire;
use App\Traits\GameTraits;
use Livewire\Component;
use Carbon;
class ChatRoom extends Component
{
public $newMessage;
public $photo;
public $messages;
public function mount($message){
// dd($message);
$this->messages = $message;
}
public function addMessage($message)
{
if($this->newMessage==''){
return;
}
array_unshift($this->messages,[
'contenu' => $this->newMessage,
'created_at' => \Carbon\Carbon::now()->diffForHumans(),
'user_id'=> 'Ness'
]);
}
public function render()
{
return view('livewire.chat-room');
}
}
chat-room.blade.php
<div class="container" id="positionbt">
<div class="row">
<div class="col-md-8 col-md-offset-2 bootstrap snippets bootdeys" >
<div class="widget-container scrollable list rollodex">
<div class="heading" id="btc">
<span class="fa"></span> Boite de communication
</div>
<div class="panel-body">
<ul class="chat">
<li class="left clearfix"><span class="chat-img pull-left" >
<img width="40" height="40" src="{{ asset('img/scrabblelogo.png') }}" alt="User Avatar" class="img-circle" />
</span>
<div class="chat-body clearfix" class="text">
<div class="header">
<strong class="primary-font">!Aide</strong>
</div>
<div class="text">
<p>
Bonjour! Afin de pouvoir effectuer les tâches ci-dessous, vous pouvez utiliser ces 5 commandes:<br>
<b>1. Placer un mot:</b> !placer ligne colonne (h|v) mot<br>
<b>2. Changer une lettre:</b> !changer lettre<br>
<b>3. Passer le tour à un autre joueur:</b> !passer<br>
<b>4. Afficher le menu d'aide:</b> !aide<br>
<b>5. Quitter menu d'aide:</b> !quitter<br>
</p>
</div>
</div>
</li>
#foreach ($messages as $message)
<li class="left clearfix"><span class="chat-img pull-left">
<img width="40" height="40" src="{{ $message->post_by->photo }}" alt="User Avatar" class="img-circle" />
</span>
<div class="chat-body clearfix">
<div class="header">
<strong class="primary-font">{{ $message->post_by->nick }}</strong> <small class="pull-right text-muted">
<span class="glyphicon glyphicon-time"></span>{{ $message->created_at }}</small>
</div>
<p>
{{ $message->contenu }}
</p>
</div>
</li>
#endforeach
</div>
<form class="panel-footer" id="msg" wire:submit.prevent="addMessage">
<div class="input-group">
<input id="btn-input" type="text" class="form-control input-sm" placeholder="Tapez votre message ici..." wire:model="newMessage"/>
<span class="input-group-btn" style="padding-top: 8px;">
<button class="btn btn-primary btn-sm" id="btn-chat" type="submit">
Envoyer</button>
</span>
</div>
</form>
</div>
</div>
</div>
</div>
I included this in jeu.blade.php
<div class="btcom">
<livewire:chat-room :message="$message"/>
</div>
and my root in web.php is below:
Route::get('/jeu', [App\Http\Controllers\LettresController::class, 'ChoisirLettresAléatoiresDuReserve'])->name('jeu');
Ok, trying to understand the goal you pursuit you can handle like this, after we can do by better way
return redirect()->route('jeu.message',['game'=> $game, 'valeur'=>$valeur, 'position' => $position,'message' => $message]);
in web.php
Route::get('/jeu/{message}', function($message){
// dd($message);
return view('jeu',['message'=>$message]);
})->name('jeu.message');
This way, you can check if inside the method when this route is load it's passing the message value and you inject it into the blade and this way can be bind by the nested component
I have a problem on this page my div.col-4 who is in div.col-9 don' t align.
I explain better with my code and my web page:
<div class="col-12 col-lg-9">
<?php
if (have_posts()) {
while(have_posts()) {
the_post(); //the_posts() invoque l itétrationde l article en cours
//the_title() afiche le titre de l article
?>
<div class="col-4 mb-4">
<div class="card">
<div class="card-body">
<h5 class="card-title"><?=the_title();?></h5>
<p>Par <a class="font-weight-bold">La horde</a>, <a class="text-dark"><em style="font-size:12px;">le <?= get_the_date() ?></em></a></p>
<p class="card-text"><?= the_excerpt(); ?></p>
Lire la suite
</div>
</div>
</div>
<?php
}
}
?>
</div>
I have 4 article create in WordPress but on my web page it is appear in vertical align why ?
I show you with a picture of my web page and the render html:
Thank s for any help.
Have a nice day.
cedric
Columns will not work as needed if no row above
As Bootstrap official site said:
In a grid layout, content must be placed within columns and only
columns may be immediate children of rows.
So you have to add <div class="row"> below <div class="col-12 col-lg-9"> however this will not make all col-4 stay at the same row, since 4*4 = 16 so the last card will go down.
If you wish to put four cards in the same row you have to change col-4 to col-3 to make the total 12, as Bootstrap official site said:
Column classes indicate the number of columns you’d like to use out of
the possible 12 per row. So, if you want three equal-width columns
across, you can use .col-4.
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap#4.6.0/dist/css/bootstrap.min.css" integrity="sha384-B0vP5xmATw1+K9KRQjQERJvTumQW0nPEzvF6L/Z6nronJ3oUOFUFpCjEUQouq2+l" crossorigin="anonymous">
<div class="col-12 col-lg-9">
<div class="row">
<div class="col-4 mb-4">
<div class="card">
<div class="card-body">
<h5 class="card-title"><?=the_title();?></h5>
<p>Par <a class="font-weight-bold">La horde</a>, <a class="text-dark"><em style="font-size:12px;">le <?= get_the_date() ?></em></a></p>
<p class="card-text"><?= the_excerpt(); ?></p>
Lire la suite
</div>
</div>
</div>
<div class="col-4 mb-4">
<div class="card">
<div class="card-body">
<h5 class="card-title"><?=the_title();?></h5>
<p>Par <a class="font-weight-bold">La horde</a>, <a class="text-dark"><em style="font-size:12px;">le <?= get_the_date() ?></em></a></p>
<p class="card-text"><?= the_excerpt(); ?></p>
Lire la suite
</div>
</div>
</div>
<div class="col-4 mb-4">
<div class="card">
<div class="card-body">
<h5 class="card-title"><?=the_title();?></h5>
<p>Par <a class="font-weight-bold">La horde</a>, <a class="text-dark"><em style="font-size:12px;">le <?= get_the_date() ?></em></a></p>
<p class="card-text"><?= the_excerpt(); ?></p>
Lire la suite
</div>
</div>
</div>
<div class="col-4 mb-4">
<div class="card">
<div class="card-body">
<h5 class="card-title"><?=the_title();?></h5>
<p>Par <a class="font-weight-bold">La horde</a>, <a class="text-dark"><em style="font-size:12px;">le <?= get_the_date() ?></em></a></p>
<p class="card-text"><?= the_excerpt(); ?></p>
Lire la suite
</div>
</div>
</div>
</div>
</div>
I post the correct answer here:
<div class="col-12 col-lg-9">
<div class="row">
<?php
if (have_posts()){
while( have_posts()){
the_post(); //the_posts() invoque l itétrationde l article en cours
//the_title() afiche le titre de l article
?>
<div class="col-4 mb-4">
<div class="card">
<div class="card-body">
<h5 class="card-title"><?=the_title();?></h5>
<p>Par <a class="font-weight-bold">La horde</a>, <a class="text-dark"><em style="font-size:12px;">le <?= get_the_date() ?></em></a></p>
<p class="card-text"><?= the_excerpt(); ?></p>
Lire la suite
</div>
</div>
</div>
<?php
}
}
?>
</div>
</div>
Hi my question is: How can I pass data from my array to another part of my html code which is not in same file.
I have file item.php and index.php In index I have array with objects. Now I have to include item.php as many times as count of item in array and every time send different data to item.
Index.php
<?php
require_once('Subject.php');
$sub1 = new Subject(
'informačné technológie',
'Absolvent študijného odboru inteligentné technológie je kvalifikovaný odborný pracovník, k
torý má vedomosti a zručnosti z oblasti informačných technológií, programovania, počítačových sietí,
smart technológií, internetu vecí, databázových systémov, základov kybernetickej bezpečnosti,
robotiky, 3D technológií, serverových a cloudových technológií, grafiky, základov elektroniky,
optimalizácie riadenia procesov a problematiky súvisiacej s digitálnou firmou. Je schopný využívať
mäkké zručnosti v prezentovaní a vystupovaní.',
'slider1.png',
'video1.mp4');
$sub2 = new Subject(
'elektrotechnika',
'Absolvent študijného odboru inteligentné technológie je kvalifikovaný odborný pracovník,
ktorý má vedomosti a zručnosti z oblasti informačných technológií, programovania,
počítačových sietí, smart technológií, internetu vecí, databázových systémov, základov
kybernetickej bezpečnosti, robotiky, 3D technológií, serverových a cloudových technológií,
grafiky, základov elektroniky, optimalizácie riadenia procesov a problematiky súvisiacej s
digitálnou firmou. Je schopný využívať mäkké zručnosti v prezentovaní a vystupovaní.',
'slider2.png',
'video2.mp4'
);
... and moore subjects can be here
$subjects = array($sub1, $sub2, $sub3, $sub4, $sub5, $sub6, $sub7);
?>
<!--Header -->
<?php include("./parts/main/header.php") ?>
<main>
<div class="container-fluid p-0">
<div class="black-overlay"></div>
<div id="dod-carousel" class="carousel slide" data-ride="carousel">
<div class="carousel-inner">
// This I need generate for every subject
<?php include("./parts/carousel-item.php") ?>
</div>
</div>
</div>
</main>
<!--Footer -->
<?php include("./parts/main/footer.php") ?>
Item.php
<div class="carousel-item active d-flex flex-column">
<div class="carousel-bg" style="background-image:url('assets/images/slider-electro.jpg')">
</div>
<div class="carousel-content w-100 flex-grow-1 d-flex flex-column justify-content-center align-items-center">
<div class="top w-100 flex-grow-1 d-flex flex-column flex-xl-row h-100 justify-content-center align-items-center p-5">
<div class="left mr-xl-5 order-2 order-xl-1">
<h2 class="slider-caption border-red text-xl-left text-center">Informačné technológie</h2>
<div class="cst-line d-xl-none mx-auto line-orange"></div>
<p class="slider-text text-center text-xl-left my-3">
HERE COMES TEXT OF SUBJECT OBJECT
</p>
<div class="text-center text-xl-left">
<a href="HERE COMES LINK OF SUBJECT" target="_blank"
class="btn btn-orange">
<i class="fas fa-hand-point-right"></i>
Pustiť video
</a>
</div>
</div>
<div class="right order-1 order-xl-2 mb-3 mb-xl-0">
<div class="video-container position-relative">
<i class="fas fa-play-circle fa-4x position-absolute"></i>
<video>
<source src=" HERE COMES LINK OF SUBJECT" type="video/mp4">
Your browser does not support the video tag.
</video>
</div>
</div>
</div>
<div class="bottom">
<?php include("navigation.php") ?>
</div>
</div>
</div>
If you have a variable in one file and then include another file from that first file, that same variable will also be available if that other file.
So in your example, if you have something like
// index.php
<?php
$subjects = [
new Subject('First Title'),
new Subject('Another Title'),
];
foreach ($subjects as $subject) {
include('item.php');
}
Then whithin your item.php you can simply access the $subject variable (exactly as it would be available within that foreach loop):
// item.php
<div class="carousel-content">
<div class="text-center">
<?php echo htmlspecialchars( $subject->getTitle() ) ?>
</div>
</div>
Of course, above is a more simplified version of your example, but it will work the same with your more detailed version.
I am trying to wrap a div around every two elements I am looping with php but I am not getting the desired output.
Below my PHP code:
<?
$diensten = "SELECT * FROM snm_content WHERE catid = 9 AND state = 1 ORDER BY ordering";
$dienstencon = $conn->query($diensten);
$tel = 1;
while($diensten = $dienstencon->fetch_assoc()){
if (strlen($diensten['introtext']) > 100){
$shortstr = substr($diensten['introtext'], 0, 100) . '...';
}else{
$shortstr = $diensten['introtext'];
}
//Wrap de slide in deze div elke 2 keer binnen de loop
if($tel % 2 == 1){
$dienstenslider .= '<div class="col-lg-12 col-md-12 col-sm-12">';
}
$dienstenslider .= '
<div class="col-lg-6 col-md-6 col-sm-12">
<div class="serv-item pull-left">
<p class="ser-tit"><i class="pe-7s-notebook"></i>'.$diensten['title'].'</p>
<p class="ser-cont">
'.strip_tags($shortstr).'
</p>
Lees meer<i class="fa fa-angle-right"></i>
</div>
</div>';
if(($tel % 2) == 0){
$dienstenslider .= '</div> <div class="col-lg-12 col-md-12 col-sm-12">';
}
$tel++;
}
if(($tel % 2) != 0){
$dienstenslider .= '</div>';
}
echo $dienstenslider;
?>
And this is the output that I am getting from that code:
<div class="box ser-box large-width-box-w1 box-h1">
<div id="service-owl" class="owl-carousel owl-theme" style="opacity: 1; display: block;">
<div class="owl-wrapper-outer autoHeight" style="height: 272px;">
<div class="owl-wrapper" style="width: 3120px; left: 0px; display: block; transition: all 1000ms ease; transform: translate3d(0px, 0px, 0px);">
<div class="owl-item" style="width: 780px;">
<div class="col-lg-12 col-md-12 col-sm-12">
<div class="col-lg-6 col-md-6 col-sm-12">
<div class="serv-item pull-left">
<p class="ser-tit"><i class="pe-7s-notebook"></i>Begeleiding Individueel</p>
<p class="ser-cont">
Begeleiding thuis is praktische hulp aan mensen die door problemen de grip op hun dagelijks leven...
</p>
Lees meer<i class="fa fa-angle-right"></i>
</div>
</div>
<div class="col-lg-6 col-md-6 col-sm-12">
<div class="serv-item pull-left">
<p class="ser-tit"><i class="pe-7s-notebook"></i>Verpleging</p>
<p class="ser-cont">
Thuis is de plek waar u het liefst wilt zijn. Daar voelt u zich het meest op uw gemak. In uw eige...
</p>
Lees meer<i class="fa fa-angle-right"></i>
</div>
</div>
</div>
</div>
<div class="owl-item" style="width: 780px;">
<div class="col-lg-12 col-md-12 col-sm-12">
<div class="col-lg-12 col-md-12 col-sm-12">
<div class="col-lg-6 col-md-6 col-sm-12">
<div class="serv-item pull-left">
<p class="ser-tit"><i class="pe-7s-notebook"></i>Hulp bij het huishouden</p>
<p class="ser-cont">
Als u door welke reden dan ook niet meer zelfstandig uw huishouden kunt voeren en hierbij (tijdel...
</p>
Lees meer<i class="fa fa-angle-right"></i>
</div>
</div>
<div class="col-lg-6 col-md-6 col-sm-12">
<div class="serv-item pull-left">
<p class="ser-tit"><i class="pe-7s-notebook"></i>Persoonlijke verzorging</p>
<p class="ser-cont">
Heeft u moeite met opstaan? Kunt u zichzelf steeds moeilijker verzorgen? Of geldt dit misschien v...
</p>
Lees meer<i class="fa fa-angle-right"></i>
</div>
</div>
</div>
<div class="col-lg-12 col-md-12 col-sm-12">
<div class="col-lg-12 col-md-12 col-sm-12">
<div class="col-lg-6 col-md-6 col-sm-12">
<div class="serv-item pull-left">
<p class="ser-tit"><i class="pe-7s-notebook"></i>Hulp bij Dementie</p>
<p class="ser-cont">
in ontwikkeling
</p>
Lees meer<i class="fa fa-angle-right"></i>
</div>
</div>
</div>
<!-- Slider -->
</div>
</div>
</div>
</div>
</div>
<div class="owl-controls clickable">
<div class="owl-pagination">
<div class="owl-page active"><span class=""></span></div>
<div class="owl-page"><span class=""></span></div>
</div>
</div>
</div>
</div>
While this is what I want:
<div class="box ser-box large-width-box-w1 box-h1">
<div id="service-owl" class="owl-carousel owl-theme" style="opacity: 1; display: block;">
<div class="owl-wrapper-outer autoHeight" style="height: 297px;">
<div class="owl-wrapper" style="width: 3120px; left: 0px; display: block; transform: translate3d(-780px, 0px, 0px); transition: all 800ms ease;">
<div class="owl-item" style="width: 780px;">
<div class="col-lg-12 col-md-12 col-sm-12">
<div class="col-lg-6 col-md-6 col-sm-12">
<div class="serv-item pull-left">
<p class="ser-tit"><i class="pe-7s-notebook"></i>Begeleiding Individueel</p>
<p class="ser-cont">
Begeleiding thuis is praktische hulp aan mensen die door problemen de grip op hun dagelijks leven...
</p>
Lees meer<i class="fa fa-angle-right"></i>
</div>
</div>
<div class="col-lg-6 col-md-6 col-sm-12">
<div class="serv-item pull-left">
<p class="ser-tit"><i class="pe-7s-notebook"></i>Verpleging</p>
<p class="ser-cont">
Thuis is de plek waar u het liefst wilt zijn. Daar voelt u zich het meest op uw gemak. In uw eige...
</p>
Lees meer<i class="fa fa-angle-right"></i>
</div>
</div>
</div>
</div>
<div class="owl-item" style="width: 780px;">
<div class="col-lg-12 col-md-12 col-sm-12">
<div class="col-lg-6 col-md-6 col-sm-12">
<div class="serv-item pull-left">
<p class="ser-tit"><i class="pe-7s-notebook"></i>Persoonlijke verzorging</p>
<p class="ser-cont">
Heeft u moeite met opstaan? Kunt u zichzelf steeds moeilijker verzorgen? Of geldt dit misschien v...
</p>
Lees meer<i class="fa fa-angle-right"></i>
</div>
</div>
<div class="col-lg-6 col-md-6 col-sm-12">
<div class="serv-item pull-left">
<p class="ser-tit"><i class="pe-7s-notebook"></i>Hulp bij Dementie</p>
<p class="ser-cont">
in ontwikkeling
</p>
Lees meer<i class="fa fa-angle-right"></i>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Slider -->
<div class="owl-controls clickable">
<div class="owl-pagination">
<div class="owl-page"><span class=""></span></div>
<div class="owl-page active"><span class=""></span></div>
</div>
</div>
</div>
</div>
How can I get that output? Even when there are an uneven amount of items being loaded?
This is what I am currently working on (the slider is not working without problems as you can see).
This is almost a copy of the website where the slider does work (the reason I am not copying that is because it is outdated/messy code).
The approach with modulo is correct, but you are writing duplicate opening tags.
the first usage is okay:
//Wrap de slide in deze div elke 2 keer binnen de loop
if($tel % 2 == 1){
$dienstenslider .= '<div class="col-lg-12 col-md-12 col-sm-12">';
}
The second usage you should only put a closing tag:
if(($tel % 2) == 0){
// the opening tag will be written in the first usage above. writing it here too results in duplicate opening tags
// $dienstenslider .= '</div><div class="col-lg-12 col-md-12 col-sm-12">';
$dienstenslider .= '</div>';
}
Then you have another usage outside your while loop. This looks okay too.
if(($tel % 2) != 0){
$dienstenslider .= '</div>';
}
I have searched on this forum for a solution and other places as well. But I can't find the problem with the code I wrote. The php file called Email_Service.php looks like this:
<?php
////////////////////////////////////////
// [Email-Service] v3.5 /
//////////////////////////////////////
//Email Service Class
class EmailService {
//Properties
private $email_basis;
private $type;
//Constructor
function __construct($type) {
echo '[EmailService] type: ' . $type;
}
//Send Email function with passed on arrays from test_pagina.php
function versturen($emailInfo, $klantInfo) {
//Email info
$email_van = $emailInfo['email_van'];
$email_naar = $emailInfo['email_naar'];
$email_onderwerp = $emailInfo['email_onderwerp'];
//Controleer of het opgegeven email adres geldig is en geen rare tekens bevat
$pattern = "/^[_a-z0-9-]+(\.[_a-z0-9-]+)*#[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$/i";
if (preg_match($pattern, trim(strip_tags($emailInfo['email_van'])))) {
$cleanedFrom = trim(strip_tags($emailInfo['email_van']));
} else {
return "The email address you entered was invalid. Please try again!";
}
//Hier word de email_template geopend voor elke type.
//Zorg vraag formulier
if ($emailInfo['type'] == 'zorgvraag') {
//$email_basis = file_get_contents(base_url() . 'include/email_template_zorgvraag.txt'); //(LOKAAL)
//file_get_contents(base_url() . "assets/email_template.txt"); //(ONLINE)
} else if ($emailInfo['type'] == 'aanmelden') {
//$email_basis = file_get_contents(base_url() . 'mail_php/email_template_aanmeldformulier.txt'); //(LOKAAL)
}
//Personaliseer de email door de velden te vervangen met de ingevulde parameters
$email_basis = str_replace("f_voornaam", $klantInfo['voornaam'], $email_basis);
$email_basis = str_replace("f_achternaam", $klantInfo['achternaam'], $email_basis);
$email_basis = str_replace("f_telefoon", $klantInfo['telefoon'], $email_basis);
$email_basis = str_replace("f_email", $klantInfo['email_van'], $email_basis);
$email_basis = str_replace("f_bericht", $klantInfo['$bericht'], $email_basis);
$email_basis = str_replace("f_locatie", $klantInfo['$locatie'], $email_basis);
//Genereer headers
$headers = "From: " . $cleanedFrom . "\r\n";
$headers .= "Reply-To: ". strip_tags($_POST['f_email']) . "\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
//Hier word de mail verstuurd als alles goed is
if (mail($emailInfo['email_naar'], $emailInfo['email_onderwerp'], $email_basis, $headers)) {
//CC
mail('info#yourdomain.nl', $emailInfo['email_onderwerp'], $email_basis, $headers);
} else {
echo 'Er is iets fout gegaan. Probeer het later nog een keer!';
die();
}
}
}
?>
It's called from another php file called test_pagina.php which looks like this:
<?php
include 'https://yourdomain.nl/assets/Email_Service.php'; //ONLINE
//require base_url() . 'assets/Email_Service.php'; //LOKAAL
//Haal gemeeente uit de adres balk
$url = "https://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
$url_onderdeel = explode('/', $url);
$gemeente = $url_onderdeel[4];
$gemeenteHoofdletter = ucfirst($gemeente);
//Email parameters
$email_van; $email_naar; $email_onderwerp = "Vraag van ". $gemeenteHoofdletter;
$voornaam; $achternaam;
$telefoon; $bericht;
$emailInfo; $klantInfo;
//Controleert de ingevulde velden
if (isset($_POST['f_email_van']) ||
isset($_POST['f_voornaam']) ||
isset($_POST['f_achternaam']) ||
isset($_POST['f_telefoon']) ||
isset($_POST['f_bericht'])) {
//Email info
$email_van = $_POST['f_email_van'];
$email_naar = "socialekaartpro#gmail.com";
/*Stuur Email
Dé Parameters:(emailInfo, klantInfo)*/
$emailInfo = array (
'email_van' => $email_van,
'email_naar' => $email_naar,
'email_onderwerp' => $email_onderwerp);
$klantInfo = array (
'voornaam' => $_POST['f_voornaam'],
'achternaam' => $_POST['f_achternaam'],
'telefoon' => $_POST['f_telefoon'],
'bericht' => $_POST['f_bericht'],
'locatie' => $gemeenteHoofdletter);
//Voeg de mail script toe zodat we de functie stuurEmail kunnen aanroepen
$mail = new EmailService('zorgvraag');
$mail -> versturen($emailInfo, $klantInfo);
}
?>
<!--=== Type Woning ===-->
<div class="page-topbar">
<div class="container">
<div class="row">
<div class="col-sm-4">
<h3>Bedrijfsnaam</h3>
</div>
<div class="col-sm-8 hidden-xs">
<ol class="breadcrumb">
<li>Gemeente Nijmegen</li>
<li>Woningverhuur</li>
<li class="active">Bedrijfsnaam</li>
</ol>
</div>
</div>
</div>
</div>
<div class="content container" style="padding-top: 10px;">
<div class="row">
<div class="col-md-12">
<div class="panel panel-default">
<div class="panel-heading left" style="margin-bottom: -1px;background-color: rgba(255, 255, 255, 0);"><i class="glyphicon glyphicon-menu-left"></i> Terug naar overzicht
<ul class="pull-right">
<i class="fa fa-print" aria-hidden="true"></i>Print
</ul>
</div>
</div>
</div>
</div>
</div>
<!--================================== Overzicht ========================-->
<div class="job-description">
<div class="container content">
<div class="row">
<div class="col-md-8">
<div class="left-inner" style="margin-left: 0px;">
<h3 style="margin-top: 28px;margin-bottom: 12px;">Test pagina</h3>
<p>
LEEG LEEG
</p>
<h3 style="margin-top: 40px;margin-bottom: 12px;">LEEG LEEG</h3>
<p>
LEEG LEEG
</p>
<h3 style="margin-top: 40px;margin-bottom: 12px;">LEEG LEEG</h3>
<p>
LEEG LEEG
</p>
<h3 style="margin-top: 40px;margin-bottom: 12px;">LEEG LEEG</h3>
<p>
LEEG LEEG
</p>
<br>
<br>
Naar de website LEEG LEEG
<br>
</div>
</div>
<div class="col-sm-4">
<div class="panel panel-default" style="margin-top: 9px;">
<div class="panel-heading" style="border-bottom-color: rgba(217, 217, 217, 0);margin-top: 2px;">Doelgroep</div>
<div class="panel-body">
<div class="row">
<p style="margin-top: -22px;margin-left: 16px;padding-right: 7px;">
LEEG | LEEG
</p>
</div>
</div>
<div class="panel-heading" style="border-bottom-color: rgba(217, 217, 217, 0);margin-top: -14px;">Leeftijdscatogarie</div>
<div class="panel-body">
<div class="row">
<p style="margin-top: -22px;margin-left: 16px;margin-bottom: 2px;">
LEEG | LEEG
</p>
</div>
</div>
</div>
<div class="panel panel-default" style="margin-top: 9px;">
<div class="panel-heading" style="border-bottom-color: rgba(217, 217, 217, 0);margin-bottom: -15px;">Contact gegevens</div>
<div class="panel-body">
<div class="row">
<div class="col-xs-4 col-md-4">
<p style="font-weight: 600;color: #000000;margin-bottom: 0px;">Naam</p>
<p style="font-weight: 600;color: #000000;margin-bottom: 0px;">Adres</p>
<p style="font-weight: 600;color: #000000;margin-bottom: 0px;">Postcode</p>
<p style="font-weight: 600;color: #000000;margin-bottom: 0px;">Plaats</p>
<p style="font-weight: 600;color: #000000;margin-bottom: 0px;">Telefoon</p>
</div>
<div class="col-xs-6 col-md-6" style="width: 65%;">
<p style="margin-bottom: 0px;">LEEG</p>
<p style="margin-bottom: 0px;">LEEG</p>
<p style="margin-bottom: 0px;">LEEG</p>
<p style="margin-bottom: 0px;">LEEG</p>
<p style="margin-bottom: 0px;">LEEG</p>
</div>
</div>
<hr style="margin-top: 20px;margin-bottom: 10px;">
<div class="row">
<div class="col-md-12">
<div class="panel-heading" style="margin-left: -15px;margin-top: -12px;margin-bottom: -15px;">
<h4 class="panel-title">
<span style="font-size: 13px;font-weight: 600;">Heeft u een zorgvraag, </span>
<a href="#mail-1" data-parent="#accordion-v1" data-toggle="collapse" class="accordion-toggle">
<span style="color: #3299bb;font-weight: 600;text-decoration: underline;"> klik dan hier</span>
</a>
</h4>
</div>
<!--Bevestiging script JSalert
<div>
<script src="https://socialekaartgemeente.nl/assets/js/sweetalert-dev.js"></script>
<script src="https://code.jquery.com/jquery-1.10.2.js"></script>
<link rel="stylesheet" href="https://socialekaartgemeente.nl/assets/css/sweetalert.css">
<script type="text/javascript">
function JSalert(){
//event.preventDefault();;
swal("Congrats!", ", Uw mail is verzonden!", "success");
}
</script>
</div>-->
<!-- =============================[EMAIL FORM]================================== -->
<!-- onSubmit="window.location.reload()" -->
<!-- ="javascript:JSalert();" -->
<div class="panel-collapse collapse" id="mail-1">
<div class="panel-body" style="margin-left: -15px;">
<form action="" method="post" id="form_mail" >
<div class="row">
<div class="col-sm-12">
<div class="form-group">
<input id="voornaam" type="text" name="f_voornaam" class="form-control" placeholder="Voornaam*" required="required" data-error="Firstname is required.">
<div class="help-block with-errors"></div>
</div>
</div>
<div class="col-sm-12">
<div class="form-group">
<input id="achternaam" type="text" name="f_achternaam" class="form-control" placeholder="Achternaam*" required="required" data-error="Firstname is required.">
<div class="help-block with-errors"></div>
</div>
</div>
<div class="col-sm-12">
<div class="form-group">
<input id="telefoon" type="text" name="f_telefoon" class="form-control" placeholder="Telefoonnummer*" required="required" data-error="Firstname is required.">
<div class="help-block with-errors"></div>
</div>
</div>
<div class="col-sm-12">
<div class="form-group">
<input id="email" type="text" name="f_email_van" class="form-control" placeholder="Email*" required="required" data-error="Firstname is required.">
<div class="help-block with-errors"></div>
</div>
</div>
</div>
<div class="form-group">
<label class="sr-only" for="message">Bericht</label>
<textarea class="input-lg form-control" name="f_bericht" rows="5" id="bericht" placeholder="Uw zorgvraag"></textarea>
<span class="help-block"></span>
</div>
<!--Verzend knop-->
<button type="submit" class="btn btn-sm btn-primary" style="margin-bottom: -15px;">Bericht verzenden</button>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="panel panel-default" style="margin-top: 9px;">
<div class="panel-body">
<div class="row">
<div class="col-md-12">
<ul class="social-icons pull-left" style="margin-left: -2px;margin-top: 4px;margin-bottom: -8px;">
<li style="margin-left: 0px;"></li>
<li></li>
<li></li>
<li></li>
<li></li>
</ul>
</div>
</div>
</div>
</div>
<!-- Google Maps -->
<div class="panel panel-default" style="margin-top: 9px;">
<div class="panel-body">
<!-- Laad Google Maps -->
<style>#map-container { height: 200px }</style>
<div id="map-container" class="col-md-12"></div>
<script src="//maps.google.com/maps/api/js?sensor=false"></script>
<script>
function init_map() {
//Definieer de coordinaten en zet zoom level
var var_location = new google.maps.LatLng(00000000, 00000000);
var var_mapoptions = {
center: var_location,
zoom: 14
};
//Plaats de marker bij de coordinaten
var var_marker = new google.maps.Marker({
position: var_location,
map: var_map,
title:"Venice"});
//^Teken the map met de instellingen hierboven^
var var_map = new google.maps.Map(document.getElementById("map-container"),
var_mapoptions);
var_marker.setMap(var_map);
}
google.maps.event.addDomListener(window, 'load', init_map);
</script>
</div>
</div>
</div>
</div>
</div>
</div>
I keep getting this error:
Fatal error:
Class 'EmailService' not found in (/file location)
Which is in this case uploaded to the server so it can be easily called upon on the whole website. I have never had this problem with writing and using a class. What am I possibly doing wrong? A lot more people have posted the same question about this error before, but they seem to have a different setup.
You can not include file by URL.
You have to use path of File location on server.
This is wrong
include 'https://yourdomain.nl/assets/Email_Service.php'; //ONLINE
//require base_url() . 'assets/Email_Service.php'; //LOKAAL
you have to use absolute or relative path
include "assets/Email_Service.php"; //relative path
include "<directory_path_of_your_project_on_server>/assets/Email_Service.php"; //absolute path
How to get Server file Location
create test.php in your root of with below content
<?php
echo dirname(__FILE__);
die;
execute above from browser, will be display path of your project on server and use that path.