I have the following html code :
<table>
<tbody>
<tr>
<th >operatore</th>
<td>3</td>
<td>4</td>
<td>5</td>
<tr/>
<tr>
<th >operatore</th>
<td>6</td>
<td>7</td>
<td>8</td>
<tr/>
</tbody>
</table>
I would like to insert the following tags after the TABLE tag:
<thead>
<tr>
<th >Nome IT</th>
<th >a</th>
<th >b</th>
<th >c</th>
</tr>
</thead>
so I'd like to get:
<table>
<thead>
<tr>
<th >Nome IT</th>
<th >a</th>
<th >b</th>
<th >c</th>
</tr>
</thead>
<tbody>
<tr>
.....
I created the following code for THEAD and succeeded:
$thead = $dom_ods->createElement("thead", "");
$ods2_tmp->insertBefore($thead, $ods2_tmp->firstChild);
$dom_ods->saveHTML();
while I can't for the others, how can I proceed?
Related
i have this code in my blade.php file
<table class="table table-success table-striped">
<thead>
<tr>
<th scope="col">ID</th>
<th scope="col">Username</th>
<th scope="col">Password</th>
<th scope="col">Email</th>
</tr>
<tbody>
#foreach($users as $user)
<tr>
<th scope="row">{{$user->ID}}</th>
<td>{{$user->username}}</td>
<td>{{$user->password}}</td>
<td>{{$user->email}}</td>
</tr>
#endforeach
</tbody>
</table>
and when i call my blade.php file to view a html page, i see only the emails from data.
This is the view when i run a dd($user) command.
This is a Html page
Looks like you got names wrong. Try this:
<table class="table table-success table-striped">
<thead>
<tr>
<th scope="col">ID</th>
<th scope="col">Username</th>
<th scope="col">Password</th>
<th scope="col">Email</th>
</tr>
<tbody>
<?php
foreach($users as $user){
echo "<tr>
<th scope='row'>".$user['ID']."</th>
<td>".$user['user_login']."</td>
<td>".$user['user_pass']."</td>
<td>".$user['user_email']."</td>
</tr>";}
?>
</tbody>
</table>
I installed TinyMCE editor on my Laravel application. I want to write HTML in my TinyMCE, like or per example.
Here is the code I put in TinyMCE :
<table class="table table-dark">
<thead>
<tr>
<th scope="col">#</th>
<th scope="col">First</th>
<th scope="col">Last</th>
<th scope="col">Handle</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">1</th>
<td>Mark</td>
<td>Otto</td>
<td>#mdo</td>
</tr>
<tr>
<th scope="row">2</th>
<td>Jacob</td>
<td>Thornton</td>
<td>#fat</td>
</tr>
<tr>
<th scope="row">3</th>
<td>Larry</td>
<td>the Bird</td>
<td>#twitter</td>
</tr>
</tbody>
</table>
So I dit it and I print the result like that :
<p>{!!html_entity_decode($vpn->intro)!!}</p>
Here is the result :
Can you help me to solve the problem please ?
<table> does not allowed to be printed inside <p>, Use <div> instead.
<div>
{!!html_entity_decode($vpn->intro)!!}
</div>
Here you can find out why.
Please I want to automatically number each row when data is displayed from the database. Something like this
<table class="table">
<thead>
<tr>
<th scope="col">#</th>
<th scope="col">First</th>
<th scope="col">Last</th>
<th scope="col">Handle</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">1</th>
<td>Mark</td>
<td>Otto</td>
<td>#mdo</td>
</tr>
<tr>
<th scope="row">2</th>
<td>Jacob</td>
<td>Thornton</td>
<td>#fat</td>
</tr>
<tr>
<th scope="row">3</th>
<td>Larry</td>
<td>the Bird</td>
<td>#twitter</td>
</tr>
</tbody>
</table>
so each row is numbered in ascending order from 1 to n depending on the data available in the database. How do I properly do that. Any Help please am new in laravel
If you are using blade, the laravel's automatically generated $loop variable might help. Like this:
<table class="table">
<thead>
<tr>
<th scope="col">#</th>
<th scope="col">First</th>
<th scope="col">Last</th>
<th scope="col">Handle</th>
</tr>
</thead>
<tbody>
#foreach($items as $item)
<tr>
<th scope="row">{{ $loop->iteration }}</th>
<td>{{ $item->first_name }}</td>
<td>{{ $item->last_name }}</td>
<td>#{{ $item->username }}</td>
</tr>
#endforeach
</tbody>
</table>
You can find documentation here: https://laravel.com/docs/8.x/blade#the-loop-variable
Here is the web page:
Update data and ID is showing while other data such as customer name, phone, etc are not showing.
CustomersController.php
public function index()
{
$customers = Customer::all();
return view('customers.index', ['customers' => $customers]);
}
index.blade.php
#extends('layouts.app')
#section('content')
<h1>Customers</h1>
#if(count($customers)>0)
<table class="table">
<thead>
<tr>
<th scope="col">ID</th>
<th scope="col">Name</th>
<th scope="col">Email</th>
<th scope="col">Phone</th>
<th scope="col">Address</th>
<th scope="col">Updated on</th>
</tr>
</thead>
#foreach($customers as $customer)
<tbody>
<tr>
<th scope="row">{{$customer->id}}</th>
<td>{{$customer->name}}</td>
<td>{{$customer->email}}</td>
<td>{{$customer->phone}}</td>
<td>{{$customer->add}}</td>
<td>{{$customer->updated_at}}</td>
</tr>
#endforeach
#else
#endif
#endsection
You didn't close <table> and <tbody>, and you placed <tbody> inside the loop (it should only appear once)
Try this:
#extends('layouts.app')
#section('content')
<h1>Customers</h1>
#if(count($customers)>0)
<table class="table">
<thead>
<tr>
<th scope="col">ID</th>
<th scope="col">Name</th>
<th scope="col">Email</th>
<th scope="col">Phone</th>
<th scope="col">Address</th>
<th scope="col">Updated on</th>
</tr>
</thead>
<tbody>
#foreach($customers as $customer)
<tr>
<td>{{$customer->id}}</td>
<td>{{$customer->name}}</td>
<td>{{$customer->email}}</td>
<td>{{$customer->phone}}</td>
<td>{{$customer->add}}</td>
<td>{{$customer->updated_at}}</td>
</tr>
#endforeach
</tbody>
</table>
#else
#endif
#endsection
You didn't close your table tag and <tbody> tag and <tbody> opening tag should be start before foreach loop.
I have the following code:
<table id="box-table-a" class="tablesorter">
<thead>
<tr>
<th scope="col">B-House/Dorm Name</th>
<th scope="col">Address</th>
<th scope="col">Price Range</th>
<th scope="col">Date Added</th>
<th scope="col">Status</th>
</tr>
</thead>
<?php
$q=mysql_query("select * from property");
while( $f=mysql_fetch_array($q, MYSQL_ASSOC))
{ $p_id=$f["p_id"];
echo"
<tbody>
<tr>
<td onblurr='hover2()' onmouseover='hover(".$p_id.")' onclick='showUser(".$p_id.")'>
<span style='cursor:pointer'>".$f['p_name']."</span></td>
<td id='pretty'>".$f['address']."</td>
<td>".$f['p_name']."</td> <td>".$f['payment_type']."</td> <td>".$status."</td> </tr>
</tbody>
";
}
?>
</table>
Any idea what may be wrong here?
Don't add <tbody></tbody> to every loop in the while! Tablesorter is very sensitive.
You did'nt sort your DB :
$q=mysql_query("select * from property ORDER BY p_name");