DOMDocument Table Content Laravel Database

40 Views Asked by At

I want to create a table content page using the DODocument method with Laravel. How do I use it? Then I want to get it from the database.

I have a code and I want to get it from the database and display it in the view.

<!DOCTYPE html>
<html>
<head>
<title>Sample table of contents</title>
</head>
<body>
<div id="table-of-contents">
     <h2>Table of Contents</h2>
     <ul>
       <li><a href="#introduction">Introduction</a></li>
       <li><a href="#section1">Section 1</a></li>
       <li><a href="#section2">Section 2</a></li>
       <li><a href="#section3">Section 3</a></li>
       <li><a href="#section2">Section 4</a></li>
     </ul>
   </div>
<h1 id="introduction">Introduction</h1>
<p>This is an introduction section.</p>
<h2 id="section1">Section 1</h2>
<p>This is part 1.</p>
<h2 id="section2">Section 2</h2>
<p>This is part 2.</p>
<h2 id="section3">Section 3</h2>
<p>This is part 3.</p>
<h2 id="section4">Section 4</h2>
<p>This is section 4.</p>
</body>
</html>
0

There are 0 best solutions below