Comments (7)
Thanks @michael-milette I tested your solution out last night on my home server and incorporated it into the PHP variant this morning insuring the proper theme prefix (gcwu, wet, base) was used for the H4 class tag inside the loop.
from wet-boew-php.
Thank you @upsonp for the quick response. I really appreciate it. Have a great day!
from wet-boew-php.
Hi @upsonp,
I noticed that what you implemented wasn't exactly what I proposed. The problem is the following two lines:
$_LINK_ = $_SITE['wb_ft'.$i.'_href_'.$_PAGE['lang1']];
if (isset($_LINK_ ) && strlen($_LINK_) > 0) {
- The $LINK =... line will cause a warning similar to the following if the variable $_SITE['wb_ft'.$i.'href'.$_PAGE['lang1']] doesn't exist (i.e. is unset): "Notice: Undefined index: wb_ft4_href_eng in /dist-php/theme-gcwu-fegc/cont/foot-nav.php on line 15"
- isset($LINK) will never be unset because the line right above it sets it. It is the $_SITE['wb_ft'.$i.'href'.$_PAGE['lang1']] variable that you want to check not the $LINK variable.
If you really want to use the $LINK variable, consider doing this instead:
$_LINK_ = (!isset($_SITE['wb_ft'.$i.'_href_'.$_PAGE['lang1']]) ? null : $_SITE['wb_ft'.$i.'_href_'.$_PAGE['lang1']]);
if (strlen($_LINK_) > 0) {
Here is the revised code block:
//add the four required footer menus
for( $i=1; isset($_SITE['wb_ft'.$i.'_text_'.$_PAGE['lang1']]); $i++ ) {
$_TEXT_ = $_SITE['wb_ft'.$i.'_text_'.$_PAGE['lang1']];
$_LINK_ = (!isset($_SITE['wb_ft'.$i.'_href_'.$_PAGE['lang1']]) ? null : $_SITE['wb_ft'.$i.'_href_'.$_PAGE['lang1']]);
if (strlen($_LINK_) > 0) {
// Add link to text only if available
$_TEXT_ = '<a'.$_TARGET_.' href="'.$_SITE['wb_ft'.$i.'_href_'.$_PAGE['lang1']].'">'.$_TEXT_.'</a>';
}
echo '<section><div class="span-2"><h4 class="gcwu-col-head">'.$_TEXT_.'</h4>'.PHP_EOL;
$_MENU_ = $_SITE['wb_ft'.$i.'_menu_file_'.$_PAGE['lang1']];
if( file_exists($_MENU_) ) {
include $_MENU_;
}
echo '</div></section>'.PHP_EOL;
}
If you prefer, the following code produces the same results and might be a little clearer for you:
//add the four required footer menus
for( $i=1; isset($_SITE['wb_ft'.$i.'_text_'.$_PAGE['lang1']]); $i++ ) {
$_TEXT_ = $_SITE['wb_ft'.$i.'_text_'.$_PAGE['lang1']];
if (isset($_SITE['wb_ft'.$i.'_href_'.$_PAGE['lang1']])) {
$_LINK_ = $_SITE['wb_ft'.$i.'_href_'.$_PAGE['lang1']];
} else {
$_LINK_ = null;
}
if (strlen($_LINK_) > 0) {
// Add link to text only if available
$_TEXT_ = '<a'.$_TARGET_.' href="'.$_SITE['wb_ft'.$i.'_href_'.$_PAGE['lang1']].'">'.$_TEXT_.'</a>';
}
echo '<section><div class="span-2"><h4 class="gcwu-col-head">'.$_TEXT_.'</h4>'.PHP_EOL;
$_MENU_ = $_SITE['wb_ft'.$i.'_menu_file_'.$_PAGE['lang1']];
if( file_exists($_MENU_) ) {
include $_MENU_;
}
echo '</div></section>'.PHP_EOL;
}
In this code block, we check to see if the $_SITE['wb_ft'.$i.'href'.$_PAGE['lang1']] variable exists (is set). If it does, assign its value to $LINK even if it is just empty. If it doesn't exist, set the $LINK variable to null.
Next, we check the link to see if there is anything in the $LINK variable. If there is, assume it is a link and turn the text into linked text.
Let me know if you have any questions or if you would like me to test the downloadable ZIP file again.
Best regards,
Michael
from wet-boew-php.
Hi @upsonp,
Just wondering if you can get this last fix into the ZIP file.
Best regards,
Michael
from wet-boew-php.
Thanks again @michael-milette,
I tried something a little different, I hope it works the same.
//add the four required footer menus
for( $i=1; isset($_SITE['wb_ft'.$i.'_text_'.$_PAGE['lang1']]); $i++ ) {
$_TEXT_ = $_SITE['wb_ft'.$i.'_text_'.$_PAGE['lang1']];
$_LINK_ = null;
if (isset($_SITE['wb_ft'.$i.'_href_'.$_PAGE['lang1']])) {
$_LINK_ = $_SITE['wb_ft'.$i.'_href_'.$_PAGE['lang1']];
}
if (strlen($_LINK_) > 0) {
// Add link to text only if available
$_TEXT_ = '<a'.$_TARGET_.' href="'.$_SITE['wb_ft'.$i.'_href_'.$_PAGE['lang1']].'">'.$_TEXT_.'</a>';
}
echo '<section><div class="span-2"><h4 class="gcwu-col-head">'.$_TEXT_.'</h4>'.PHP_EOL;
$_MENU_ = $_SITE['wb_ft'.$i.'_menu_file_'.$_PAGE['lang1']];
if( file_exists($_MENU_) ) {
include $_MENU_;
}
echo '</div></section>'.PHP_EOL;
}
from wet-boew-php.
Hi @upsonp,
In one of the files, dist-php\theme-gcwu-intranet\cont\foot-nav.php, you forgot to remove one of the IF statements:
if (isset($_LINK_ ) && strlen($_LINK_) > 0) {
Here is the code the way it is:
if (strlen($_LINK_) > 0) {
if (isset($_LINK_ ) && strlen($_LINK_) > 0) {
// Add link to text only if available
$_TEXT_ = '<a'.$_TARGET_.' href="'.$_LINK_ .'">'.$_TEXT_.'</a>';
}
This is what it is supposed to be:
if (strlen($_LINK_) > 0) {
// Add link to text only if available
$_TEXT_ = '<a'.$_TARGET_.' href="'.$_LINK_ .'">'.$_TEXT_.'</a>';
}
The ones for the other themes all work perfectly.
Let me know if you have any questions.
Best regards,
Michael
from wet-boew-php.
Thanks @michael-milette I've made the correction
from wet-boew-php.
Related Issues (20)
- remove links on footer menu headers HOT 1
- Maintenance Mode... HOT 2
- PHP Menu Generator HOT 18
- Links in header need to be updated HOT 9
- V4 missing error page coding. HOT 10
- V4 Archived page don't show ARCHIVED - in the title HOT 2
- V4 Archived text need to be updated
- Cloning just the DIST-PHP folder instead of the whole project HOT 8
- GOC Template user how do you... HOT 2
- V4 New issue found while validating with WPSS HOT 2
- WET4 changes that need to be take care! HOT 5
- wet-boew-php as bower dependency HOT 9
- wet-boew-php 4.0 HOT 11
- The Secondary Utility Menu Page - side menu doesn't work. HOT 3
- Base theme footer background is the wrong colour HOT 6
- Title is just a slash on language selection splash page of on demos-php HOT 7
- FIP images missing on 404 server pages in demos-php site HOT 6
- WET 4 - Missing support for session login/logout (sign in/sign out) HOT 3
- Please tag v4.0 branch HOT 2
- GCWeb Canada.ca Redesign theme HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from wet-boew-php.