第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機(jī)立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

導(dǎo)航欄圖標(biāo)應(yīng)該在某些頁面上改變顏色

導(dǎo)航欄圖標(biāo)應(yīng)該在某些頁面上改變顏色

PHP
慕容3067478 2022-07-22 19:16:20
我希望我的導(dǎo)航欄圖標(biāo)在用戶位于某個頁面時(例如在 instagram 等)上改變顏色。這就是我嘗試過的 - bottomBar.php:if ($page == 'friends') { $theme = 'link_friendsWall_active'; $theme2 = 'link_index'; $theme3 = 'link_trophypage'; $theme4 = 'link_selfpage';} else if ($page == 'index') { $theme = 'link_friendsWall'; $theme2 = 'link_index_active'; $theme3 = 'link_trophypage'; $theme4 = 'link_selfpage';} else if ($page == 'trophy') { $theme = 'link_friendsWall'; $theme2 = 'link_index'; $theme3 = 'link_trophypage_active'; $theme4 = 'link_selfpage';} else if ($page == 'profile') { $theme = 'link_friendsWall'; $theme2 = 'link_index'; $theme3 = 'link_trophypage'; $theme4 = 'link_selfpage_active';}$page 是指在 index.php(作為索引)、friendsWall.php(作為朋友)等文件中定義的變量,其中包含 bottom_menu。主題定義的變量是在 css 中設(shè)置樣式的類。然后在我的底部菜單中,我調(diào)用了這些變量:<div class="bottom_menu">    <li><a class="<?=$theme?>" href="includes/handlers/friends_link.php">            <i class="fas fa-user-friends"></i>        </a></li>    <li><a class="<?=$theme2?>" href="index.php">            <i class="fas fa-users "></i>        </a></li>    <li><a href="#">            <i class="fas fa-plus-circle"></i>        </a></li>    <li><a class="<?=$theme3?>" href="trophyPage.php">            <i class="fas fa-trophy"></i>        </a></li>    <li><a class="<?=$theme4?>" href="myProfile.php">            <img class='img_bottom_bar' src="<?php echo $user['profile_pic']; ?>" width="30px" height="30px" border-radius="20px">        </a></li></div>我的問題是該網(wǎng)站沒有從其他頁面讀取變量 $page 。索引.php:  session_start();  include("includes/header.php");  include("includes/bottomBar.php"); include("includes/classes/User.php"); include("includes/classes/Post.php"); $page = 'index';
查看完整描述

3 回答

?
慕標(biāo)5832272

TA貢獻(xiàn)1966條經(jīng)驗 獲得超4個贊

解決方案:在包含bottomBar之前定義一個公共變量



查看完整回答
反對 回復(fù) 2022-07-22
?
米琪卡哇伊

TA貢獻(xiàn)1998條經(jīng)驗 獲得超6個贊

變量在$page使用后定義


 session_start();


  $page = 'index'; // definition


  include("includes/header.php");

  include("includes/bottomBar.php"); // Using


 include("includes/classes/User.php"); 

 include("includes/classes/Post.php");


查看完整回答
反對 回復(fù) 2022-07-22
?
千巷貓影

TA貢獻(xiàn)1829條經(jīng)驗 獲得超7個贊

正如評論中指出的那樣,您在定義變量bottomBar.php 之前$page包括在內(nèi)。所以,什么時候bottomBar.php被渲染,$page仍然是未定義的!

因此,只需在 include$page之前定義bottomBar.php

$page = 'index';
include("includes/bottomBar.php");



查看完整回答
反對 回復(fù) 2022-07-22
  • 3 回答
  • 0 關(guān)注
  • 153 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號