I've got the following simple search page. 3 fields (one with fixed value) and submit button. When I click submit nothing happens at all. not even reload or anything. the button does nothing. Ignore the arabic in there, I have a feeling it got to do with arrangements of divs or placement of form_open.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>منزلي</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="<?php echo base_url();?>support/css/main.css" media="screen" />
</head>
<body>
<div id="header">
<div id="logo">
منزلي
</div>
<ul id="list-nav">
<li>للإتصال بنا </li>
<li>عن الموقع</li>
<li>منازل للبيع</li>
<li>منازل للإيجار</li>
<li>الرئيسية</li>
</ul>
</div>
<?
$this->load->helper('form');
form_open('search/search_properties'); ?>
<div id="center">
المدينة:
<select name="city">
<option>الخبر</option>
<option>الدمام</option>
<option>الظهران</option>
</select>
<br><br>
Type: <input type="text" value="flat" name="propertyType"/> <br><br>
حدود السعر:
<select name="range">
<option> <20000 </option>
<option>20000-30000</option>
<option>30000-40000</option>
<option>40000-50000</option>
<option> >500000 </option>
</select>
<br><br>
<input type="submit" value="بحث"/>
</form>
</div>
<div id="footer">
<p>2012 منزلي ©</p>
</div>
</body>
</html>
Any idea why this is happening?
thanks all for support
<?
$this->load->helper('form');
form_open('search/search_properties'); ?>
should be
<?
$this->load->helper('form');
echo form_open('search/search_properties'); ?>
Related
So I have started a spring boot project. The HTML loads fine, however, thyme-leaf seems to have trouble loading static files. The two files are in packages such as static.css and static.js. I get an ERR_ABORTED:404 error for loading both files and can not figure out why.
I have already tried changing the path (as suggested in other similar questions) to something like #{css/styles.css} instead of #{/css/styles.css} but that did not work.
Does anyone know if I'm missing something here?
Below is the HTML file:
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<title>Title</title>
<link rel="stylesheet" th:href="#{/css/styles.css}">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"></script>
</head>
<body>
<div class="bg-img">
<div class="content">
<header>Login Form</header>
<form action="#">
<div class="field">
<span class="fa fa-user"></span>
<input type="text" required placeholder="Email or Phone">
</div>
<div class="field space">
<span class="fa fa-lock"></span>
<input type="password" class="pass-key" required placeholder="Password">
<span class="show">SHOW</span>
</div>
<div class="pass">
Forgot Password?
</div>
<div class="field">
<input type="submit" value="LOGIN">
</div>
</form>
<div class="login">Or login with</div>
<div class="links">
<div class="facebook">
<i class="fab fa-facebook-f"><span>Facebook</span></i>
</div>
<div class="instagram">
<i class="fab fa-instagram"><span>Instagram</span></i>
</div>
</div>
<div class="signup">Don't have account?
Signup Now
</div>
</div>
</div>
<script type="text/javascript" th:src="#{/js/loginscript.js}"></script>
</body>
where is your css folder?
css, js should be in static folder
src
main
java
resources
static
css
i18n
img
js
templates
Add this in your head tag:
<link rel="stylesheet" href="../static/css/styles.css" type="text/css" th:href="#{/styles.css}">
Note: Above code will only work if styles.css present in below path:
|--resources
|--static
|--css
|--styles.css
This is here for anyone who finds this, it turns out for the th:href property, I had to give the full path as th:href="#{../static/css/styles.css}". Thanks to everyone who answered!
I've a page in MVC which I want to reload automatically every 2 seconds without doing a refresh, I have seen examples
with Ajax but all referenced using buttons or in POST-GET events. I only want it to reload without refresh,
What can I do to perform that function?
Thank you
This's my view
#model MVC_PCMonitoring_Dash.Models.TablesPCModels
#{
ViewBag.Title = "Home Page";
}
<!doctype html>
<html lang="en">
<head>
<title>Dashboard</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="stylesheet" href="~/Content/css/style.css">
</head>
<body>
<div class="wrapper d-flex align-items-stretch">
<nav id="sidebar">
<div class="custom-menu">
</div>
<div class="img bg-wrap text-center py-4" style="background-color: #A40033;">
<div class="user-logo">
<div class="img" style="background-image: url(Images/logo.jpg)"></div>
<h3>TOTAL PC</h3>
</div>
</div>
<ul class="list-unstyled components mb-5">
<li class="active">
Home
</li>
<li>
PC 1
</li>
<li>
PC 2
</li>
<li>
Exit
</li>
</ul>
</nav>
<!-- Page Content -->
<div id="content" class="p-4 p-md-5 pt-5">
<p align="right">#DateTime.Now</p>
<center>
<img src="~/Images/welcome.png" alt="centered image" />
</center>
</div>
</div>
<script src="js/jquery.min.js"></script>
<script src="js/popper.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/main.js"></script>
</body>
</html>
You should use timer and ajax in this case.
setInterval(function(){ --ajax call to refresh---},2000) //2000 means 2 min
I want to include a bootstrap template on codeigniter code, so i included the template in views folder and then i called it in controller but i can't see the template in my page
Here's my code:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Bootsrtap Free Admin Template - SIMINTA | Admin Dashboad Template</title>
<!-- Core CSS - Include with every page -->
<link href="plugins/bootstrap/bootstrap.css" type="text/css" rel="stylesheet" />
<link href="font-awesome/css/font-awesome.css" type="text/css" rel="stylesheet" />
<link href="plugins/pace/pace-theme-big-counter.css" type="text/css" rel="stylesheet" />
<link href="css/style.css" type="text/css" rel="stylesheet" />
<link href="css/main-style.css" type="text/css" rel="stylesheet" />
</head>
<body class="body-Login-back">
<div class="container">
<div class="row">
<div class="col-md-4 col-md-offset-4 text-center logo-margin ">
<img src="img/logo.png" alt=""/>
</div>
<div class="col-md-4 col-md-offset-4">
<div class="login-panel panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">Please Sign In</h3>
</div>
<div class="panel-body">
<form role="form">
<fieldset>
<div class="form-group">
<input class="form-control" placeholder="E-mail" name="email" type="email" autofocus>
</div>
<div class="form-group">
<input class="form-control" placeholder="Password" name="password" type="password" value="">
</div>
<div class="checkbox">
<label>
<input name="remember" type="checkbox" value="Remember Me">Remember Me
</label>
</div>
<!-- Change this to a button or input when using this as a form -->
Login
</fieldset>
</form>
</div>
</div>
</div>
</div>
</div>
<!-- Core Scripts - Include with every page -->
<script src="plugins/jquery-1.10.2.js"></script>
<script src="plugins/bootstrap/bootstrap.min.js"></script>
<script src="plugins/metisMenu/jquery.metisMenu.js"></script>
</body>
</html>
this is login.php (in views folder)
---------------
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Bootsrtap Free Admin Template - SIMINTA | Admin Dashboad Template</title>
<!-- Core CSS - Include with every page -->
</head>
Controller
<?php if ( ! defined('BASEPATH')) exit('No direct access allowed');
class Login extends CI_Controller
{
public function index()
{
$this->load->view('login');
}
}
and this is login.php (in controllers folder)
please help me with this problem
Well first off you should all ways have your assets out side of your application folder.
Because the .htaccess file that is inside the application folder blocks that
project >
project > application
project > assets
project > system
project > index.php
project > .htaccess <!-- use a htaccess here for removing index.php
Second set your base_url in config > config.php
// You are recommend to do so in CI 3 + versions
$config['base_url'] = 'http://localhost/yourprojectname/';
Third Auto load the url helper config > autoload.php
$autoload['helper'] = array('url');
Controller Make sure your class and file name first letter only upper
case
As said here http://www.codeigniter.com/user_guide/general/controllers.html#let-s-try-it-hello-world
Filename Example.php
<?php
class Example extends CI_Controller {
public function index() {
$this->load->view('header');
$this->load->view('example');
$this->load->view('footer');
}
}
Then create a header.php and footer.php and example.php view
http://www.codeigniter.com/user_guide/general/views.html#loading-multiple-views
header.php view
<!DOCTYPE html>
<html>
<head>
<title></title>
<link rel="stylesheet" type="text/css" href="<?php echo base_url('assets/bootstrap/css/bootstrap.css');?>">
</head>
<body>
example.php view
Any content you need
footer.php view
<script type="text/javascript" src="<?php echo base_url('assets/bootstrap/js/bootstrap.js');?>"></script>
</body>
</html>
This is an example. Make a folder, that called is assets, paste all style, js resources into it.
Please show you console log tab. Example:
so I need to include a couple of files from a subdomain from the main domain (my subdomain is admin.mydomain.com and targets to => mydomain.com/admin/), but I can't get to.
My public_html structure is
-admincp (empty, this is the subdomain)
-css
-js
-includes
-fonts
-images
I need to include all the css, js and some php files (which are in /includes/) in the subdomain index but for some reason it retrieves nothing using "/css/xxx.css".
I've tried using "/home/user/public_html/includes" (or css, or js) and actually worked, but the problem then is the file I need to include (the header for example) is like this:
<?php
session_start();
?>
<!DOCTYPE html>
<html lang="es-ar">
<head>
<meta charset="utf-8" />
<meta name="description" content="<?php echo $meta_description ?>" />
<meta name="author" content="Gaspar Dip" />
<title><?php echo $page_title ?></title>
<link rel="shortcut icon" href="/images/favicon.ico">
<link rel="stylesheet" href="/css/metro-bootstrap.min.css">
<link rel="stylesheet" href="/css/metro-bootstrap-responsive.min.css">
<link rel="stylesheet" href="/css/iconFont.min.css">
</head>
<body class="metro">
<nav class="navigation-bar light">
<div class="navigation-bar-content">
<span class="icon-stats-2"></span> Estudio Benintendi
<span class="element-divider"></span>
<a class="pull-menu" href="#"></a>
<ul class="element-menu">
<li>Inicio<li>
<li>Acerca del estudio<li>
<li>Enviar curriculum<li>
<li>Contactenos</li>
</ul>
<div class="no-tablet-portrait">
<span class="element-divider"></span>
<div class="element input-element">
<form>
<div class="input-control text">
<input type="text" placeholder="Buscar...">
<button class="btn-search"></button>
</div>
</form>
</div>
<?php if(!isset($_SESSION["username"])){ ?>
<ul class="element-menu place-right">
<li>Iniciar sesión</li>
<li>Registrarse</li>
</ul>
<?php }else{ ?>
<div class="element place-right">
<a class="dropdown-toggle" href="#">
<span class="icon-cog"></span>
</a>
<ul class="dropdown-menu place-right" data-role="dropdown">
<li>Products</li>
<li>Download</li>
<li>Support</li>
<li>Salir</li>
</ul>
</div>
<span class="element-divider place-right"></span>
<button class="element place-right">
<span class="icon-user-3"></span>
<?php echo $_SESSION["username"]; ?>
</button>
<?php } ?>
<span class="element-divider place-right"></span>
</div>
</div>
</nav>
<div class="container">
So those links targetting the .css files actually go to admincp.mydomain.com/css/xxx.css instead of mydomain.com/css/xxx.css
Did I explain myself?
Possibly giving the absolute path can make difference.
I mean full path to the css link something like
<link rel="stylesheet" href="<?php echo FULL_PATH_TO_CSS; ?>/css/xxx.css"/>
Can you try this?
<link rel="stylesheet" href="../css/xxx.css"/>
This is not tested.
i want to assign a variable $layout_data['navigation']=$this->load('layout/navigation')
navigation is just a list.
when i pass this variable to my layout the list comes at the top.
here are my codes:
htaccess
RewriteEngine On
RewriteBase /ci/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /ci/index.php/$1 [L]
controller home
<?php
class Home extends CI_Controller{
function index() {
$layout_data['navigation']=$this->load->view('navigation');
$this->load->view('layout/main',$layout_data);
}//end of index
}//end of class
?>
layout/navigation (its a view)
<li><span>About Us</span></li>
<li><span>Objective</span></li>
layout/main (this is my layout)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Rainbow Handicraft-giving training and employment oppurtunities to women |in association with Rainbow Children Home</title>
<link href="<?php echo $this->config->base_url('assets/css/css/style.css'); ?>" type="text/css" rel="stylesheet" media="all"/>
</head>
<body>
<div id="top_header">
In association with Rainbow Children Home Nepals
</div>
<!-- end of top header-->
<div id="container">
<div id="header">
<div id="left_logo">
</div>
<div id="logo">
<h1>Rainbow Handicraft Nepal</h1>
<h2>Lakeside Pokhara 06 Nepal</h2>
<h3>Email- rhn#gmail.com</h3>
</div>
<div id="right_logo">
</div>
<div id="right_logo2">
</div>
<div id="right_logo3">
</div>
</div>
<!--end of header-->
<div id="wrapper">
<div id="menu">
<div id="tabs">
<ul>
<li></li>
<?php echo $content_navigation;?>
</ul>
</div>
</div><!--end of menu-->
<div id="main_content">
<div id="leftbar">
<div id="left_content">
<p class="title">mytitle</p>
<p class="mycontent">
mycontent
</p>
</div><!--end of left content-->
<div id="left_content">
<p class="title">asdfasdf</p>
<p class="mycontent">
sadfsadfasdf</p>
</div><!--end of left content-->
</div><!--end of left bar-->
<div id="rightbar">
<div id="right_content">
<div>
<p class="title">This is the title</p>
<p class="mycontent"> mycontent
</p>
</div>
</div><!--end of right content-->
<div id="right_content">
<div>
<p class="title">This is the title</p>
<p class="mycontent"> this is right content
</p>
</div>
</div><!--end of right content-->
</div><!--end of right bar-->
</div><!--end of wrapper-->
<div class="push"></div>
</div><!--end of container-->
<div id="footer">
<div id="footer_main">
Rainbow Handicraft Nepal</br>
Po Box 210,Dihikopatan, Lakeside ,Pokhara-6,Nepal</br>
© Copyrights 2010 All rights Reserved. </br>Designed by: <span class="sagaritabd"><i><b>sagaritabd</b></i></span>
</div>
</div><!--end of footer-->
</body>
</html>
when i see source of output file i see the problem but cant fix it
<li><span>About Us</span></li>
<li><span>Objective</span></li>
<li><span>Items</span></li>
<li><span>Contact</span></li><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Rainbow Handicraft-giving training and employment oppurtunities to women |in association with Rainbow Children Home</title>
<link href="http://localhost/ci/assets/css/css/style.css" type="text/css" rel="stylesheet" media="all"/>
</head>
<body>
<div id="top_header">
In association with Rainbow Children Home Nepals
</div>
<!-- end of top header-->
<div id="container">
<div id="header">
<div id="left_logo">
</div>
......
please help
This line:
$layout_data['navigation'] = $this->load->view('layout/navigation');
...will output the view immediately. You need to set the third parameter to TRUE:
$layout_data['navigation'] = $this->load->view('layout/navigation', NULL, TRUE);
The second parameter is your data array, should you need it. You can pass in an empty string or NULL if you don't need it.
It's here in the user guide, all the way down at the bottom:
http://codeigniter.com/user_guide/general/views.html
Returning views as data
There is a third optional parameter lets you change the behavior of
the function so that it returns data as a string rather than sending
it to your browser. This can be useful if you want to process the data
in some way. If you set the parameter to true (boolean) it will return
data. The default behavior is false, which sends it to your browser.
Remember to assign it to a variable if you want the data returned:
As an addendum, you may want to add some of that logic to a MY_Controller. I'm guessing you will be loading the navigation every page, so do that load logic as part of the constructor in MY_Controller and then extend that class, and make sure there is a protected variable like $data[] that exists as well. This way you can enforce consistent naming of the navigation data and make sure it always gets passed.