我已经在yii2中编写了代码,并在布局文件夹中包含header.php和footer.php独立文件,并将这些文件包含在main.php中,该文件也存在于布局文件夹中,但是当我运行该文件时,我可以看到页脚,但没有页眉,但存在页眉我可以随机单击页眉部分,并单击一些登录和签名按钮。但看不到标题。
我尝试将所有图像,CSS和JS文件包括在布局文件夹中,但直到无法正常工作,而且我还在sitecontroller中包括了$ layout,但仍然无济于事。
<header>
<!-- Nav Bar -->
<div class="navBar">
<div class="container-fluid">
<div class="row">
<aside class="col-md-4 col-sm-3">
<a href="#" class="logo"><img src="images/logo.png" class="img-responsive hidden-xs"><img src="images/r-logo.png" class="img-responsive hidden-sm hidden-md hidden-lg"></a>
</aside>
<aside class="col-md-8 col-sm-9">
<div id="cssmenu">
<ul>
<li class="active"><a href="#">Write Itinerary </a></li>
<li><a href="#">Help</a></li>
<li><a href="#" data-toggle="modal" data-target="#signUp">Sign Up</a></li>
<li><a href="#" data-toggle="modal" data-target="#login">Log In</a></li>
</ul>
</div>
</aside>
</div>
</div>
</div>
</header>
<!-- Slider Banner -->
<section class="mainSlide">
<div id="banner" class="owl-carousel owl-theme">
<div class="item">
<div class="overLay"></div>
<img src="images/slide1.jpg" class="img-responsive"> </div>
<div class="item">
<div class="overLay"></div>
<img src="images/slide2.jpg" class="img-responsive"> </div>
</div>
<div class="smallDevice">
<h1 class="hidden-sm hidden-md hidden-lg">Find the perfect Trips & Itineraries</h1>
<p class="hidden-sm hidden-md hidden-lg">Lorem Ipsum is simply dummy text of the printing and typesetting industry.</p>
<a class="open-mypage1"><i class="fa fa-search"></i> Search Here</a>
</div>
<div id="mypage-info1" class="slideForm">
<a href="#" class="up"><i class="fa fa-chevron-up" aria-hidden="true"></i></a>
<div class="bannerCaption">
<div class="container">
<h1 class="hidden-xs">Find the perfect Trips & Itineraries</h1>
<p class="hidden-xs">Lorem Ipsum is simply dummy text of the printing and typesetting industry.</p>
<ul class="filterForm">
<li>
<input type="text" placeholder="Continents">
</li>
<li>
<input type="text" placeholder="Select your country ">
</li>
<li>
<input type="text" placeholder="Select your city ">
</li>
<li>
<button>Search</button>
</li>
</ul>
</div>
</div>
</div>
</section>
主文件:
<?php
/* @var $this \yii\web\View */
/* @var $content string */
use yii\helpers\Html;
use yii\bootstrap\Nav;
use yii\bootstrap\NavBar;
use yii\widgets\Breadcrumbs;
use frontend\assets\AppAsset;
use frontend\widgets\Metadata;
use common\widgets\Alert;
AppAsset::register($this);
?>
<?php $this->beginPage() ?>
<!DOCTYPE html>
<html lang="<?= Yii::$app->language ?>">
<head>
<meta charset="<?= Yii::$app->charset ?>">
<meta name="viewport" content="width=device-width, initial-scale=1">
<?= Html::csrfMetaTags() ?>
<meta name="google-site-verification" content="_LfxXaxrGXxez14d8E2Q8RpIqtoWC7-ZXEW_ylyxsqU" />
<link rel="icon" type="image/png" href="<?php echo Yii::$app->getUrlManager()->createUrl('images/favicon.png');?>" />
<?php $this->head() ?>
<link href="https://fonts.googleapis.com/css?family=Open+Sans:300,400,600,700" rel="stylesheet">
<link href="<?php echo Yii::$app->getUrlManager()->createUrl('css/owl.carousel.min.css');?>" rel="stylesheet">
<link href="<?php echo Yii::$app->getUrlManager()->createUrl('css/owl.theme.default.min.css');?>" rel="stylesheet" type="text/css">
<link href="<?php echo Yii::$app->getUrlManager()->createUrl('css/fonts.css');?>" rel="stylesheet" type="text/css">
<link href="<?php echo Yii::$app->getUrlManager()->createUrl('css/style.css');?>" rel="stylesheet" type="text/css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-validate/1.15.1/jquery.validate.js"></script>
<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=AIzaSyCB0tU77lobH0Aq7RZXpOM__TvXaTSmqso&libraries=places"></script>
</head>
<body>
<?php $this->beginBody() ?>
<!--START HEADER-->
<?php include_once('header.php'); ?>
<!--END HEADER--->
<!--VIEW BODY-->
<?php echo $content; ?>
<!--END BODY-->
<!--START FOOTER-->
<?php include_once('footer.php'); ?>
<!--END FOOTER-->
<?php $this->endBody() ?>
</body>
</html>
<?php $this->endPage() ?>
没有错误,只是看不到标题,而是能够通过在标题部分随机单击来单击。
答案 0 :(得分:0)
似乎您在import win32com.client
from win32com.client import Dispatch
x = win32com.client.Dispatch("AppRobotic.API")
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
driver = webdriver.Chrome('chromedriver.exe')
driver.get('https://www.google.com')
# wait 20 seconds
x.Wait(20000)
# scroll down a couple of times in case page javascript is waiting for user interaction
x.Type("{DOWN}")
x.Wait(2000)
x.Type("{DOWN}")
x.Wait(2000)
# forcefully stop pageload at this point
driver.execute_script("window.stop();")
# if clicking Download as CSV button with Selenium still does not work here, use screen coordinates
x.MoveCursor(xCoord, yCoord)
x.MouseLeftClick
x.Wait(2000)
目录中有header.php
和footer.php
文件。如果正确,则需要使用layouts
方法而不是render()
。
请参见下面的代码如何包括页眉和页脚文件,我假设您在include_once
目录中包含这些文件,否则请调整路径。
注意:您应避免使用@frontend/views/layouts
之类的短代码,而应使用<?php=?>
。
<?php echo ?>