Reputation: 264
I have a web site with a page having web form to enter data into mysql database. Now requirement has changed and I need to convert the whole web site to laravel.
In current web page there is index.php which has a menu strip and a iframe. on clicking a menu item the linked page is opened in the Iframe. Now How to achieve the same flexiblity using Laravel.
How to redirect/route the web form in the iframe.
Below is the index.php
<html>
<head>
<script type="text/javascript" src="JS/header.js"></script>
<link href="css/stylesheets.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div class="menustrip">
<ul>
<li><a href="index.php" onclick="OpenForm('register.php');">Register</a></li>
<li><a href="index.php" onclick="OpenForm('search.php');">Search</a></li>
</ul>
</div>
<div class="iframe" style="position:fixed;top:62px; left:0; width:100%; height:100%;" >
<iframe name="main" id="main" src="" frameborder="0" width="99%" height="95%" align="left"><FONT FACE=ARIAL SIZE=3 COLOR="RED">Your Browser doesn't Support Required Component.</FONT></iframe>
</div>
</body>
</html>
Upvotes: 3
Views: 24438
Reputation: 2724
You can use iframe in Laravel blade like this.
This is for local .html file(file in public dir)
<iframe src="{{URL::to('/')}}/your file path here" width="100%" height="600"></iframe>
This is for the online url
<iframe src="http://www.onlineicttutor.com/wp-content/uploads/2016/04/pdf-at-iframe.pdf" width="100%" height="300"></iframe>
Upvotes: 4
Reputation: 2366
I think that the OpenForm()
functions just sets the src of the iframe to the register.php in first case and to search.php so instead of going to register.php
or search.php
you define these at the route file.
in Route.php define the register
Ex:
Route::get('register', function () {
//code to go here or use controllers
return view('register');
});
Then just set the src of the iframe to register and you will have the same approach as your site in core PHP.
Upvotes: 0