Chrisj Posted February 17, 2019 Share Posted February 17, 2019 I am trying to display some text "THIS IS A TEST" on the html page. I am getting this error: Notice: Undefined variable: text1 in /home/public_html/themes/videos/content.html on line 23 line 23 is this: <div class="test"><font color="#696969" font size="3" face="Arial">HELLO<?php echo $text1;?></font> The php file, related to the html page shows this (partially): $text1 = "THIS IS A TEST"; $cateogry_id = ''; $videos = array(); if ($page == 'trending') { $title = $lang->trending; $db->where('privacy', 0); $videos = $db->where('time', time() - 172800, '>')->orderBy('views', 'DESC')->get(T_VIDEOS, $limit); } else if ($page == 'latest') { $title = $lang->latest_videos; echo "$text1"; $db->where('privacy', 0); $videos = $db->orderBy('id', 'DESC')->get(T_VIDEOS, $limit); } else if ($page == 'top') { $title = $lang->top_videos; $db->where('privacy', 0); $videos = $db->orderBy('views', 'DESC')->get(T_VIDEOS, $limit); } else if ($page == 'category') { if (!empty($_GET['id'])) { if (in_array($_GET['id'], array_keys($categories))) { $cateogry = PT_Secure($_GET['id']); $title = $categories[$cateogry]; $cateogry_id = "data-category='$cateogry'"; $db->where('privacy', 0); $videos = $db->where('category_id', $cateogry)->orderBy('id', 'DESC')->get(T_VIDEOS, $limit); } else { header("Location: " . PT_Link('404')); exit(); } } } what do I need to correct to remedy the error? Any help is appreciated. Quote Link to comment https://forums.phpfreaks.com/topic/308343-help-with-undefined-variable-error/ Share on other sites More sharing options...
requinix Posted February 17, 2019 Share Posted February 17, 2019 1 hour ago, Chrisj said: The php file, related to the html page "Related" how? The PHP needs to be executed before the HTML, and they must both happen during the same request (so like without any redirects). Quote Link to comment https://forums.phpfreaks.com/topic/308343-help-with-undefined-variable-error/#findComment-1564523 Share on other sites More sharing options...
Chrisj Posted February 17, 2019 Author Share Posted February 17, 2019 Thanks for your reply. Sorry for the truncated code posting. There is a php file (where I added line 35 and line 39): <?php declare( strict_types=1); // these should be set in PHP.ini error_reporting(-1); // set maximum errors ini_set('display_errors' , 'true'); if (empty($_GET['page'])) { header("Location: " . PT_Link('404')); exit(); } $page = PT_Secure($_GET['page']); $limit = 20; $pt->rss_feed = false; $pt->exp_feed = true; $pages = array( 'trending', 'category', 'latest', 'top' ); if (!in_array($page, $pages)) { header("Location: " . PT_Link('404')); exit(); } if (!empty($_GET['feed']) && $_GET['feed'] == 'rss') { $limit = 50; $pt->rss_feed = true; } $text1 = 'THIS IS A TEST'; $cateogry_id = ''; $videos = array(); if ($page == 'trending') { $text1 = 'trending'; $title = $lang->trending; $db->where('privacy', 0); $videos = $db->where('time', time() - 172800, '>')->orderBy('views', 'DESC')->get(T_VIDEOS, $limit); } else if ($page == 'latest') { $title = $lang->latest_videos; $db->where('privacy', 0); $videos = $db->orderBy('id', 'DESC')->get(T_VIDEOS, $limit); } else if ($page == 'top') { $title = $lang->top_videos; $db->where('privacy', 0); $videos = $db->orderBy('views', 'DESC')->get(T_VIDEOS, $limit); } else if ($page == 'category') { if (!empty($_GET['id'])) { if (in_array($_GET['id'], array_keys($categories))) { $cateogry = PT_Secure($_GET['id']); $title = $categories[$cateogry]; $cateogry_id = "data-category='$cateogry'"; $db->where('privacy', 0); $videos = $db->where('category_id', $cateogry)->orderBy('id', 'DESC')->get(T_VIDEOS, $limit); } else { header("Location: " . PT_Link('404')); exit(); } } } use Bhaktaraz\RSSGenerator\Item; use Bhaktaraz\RSSGenerator\Feed; use Bhaktaraz\RSSGenerator\Channel; //Export rss feed if ($pt->rss_feed) { $rss_feed_xml = ""; $fl_rss_feed = new Feed(); $fl_rss_channel = new Channel(); $fl_rss_channel ->title($pt->config->title) ->description($pt->config->description) ->url($pt->config->site_url) ->appendTo($fl_rss_feed); if (is_array($videos)) { foreach ($videos as $feed_item_data) { $feed_item_data = PT_GetVideoByID($feed_item_data, 0, 0, 0); $fl_rss_item = new Item(); $fl_rss_item ->title($feed_item_data->title) ->description($feed_item_data->markup_description) ->url($feed_item_data->url) ->pubDate($feed_item_data->time) ->guid($feed_item_data->url,true) ->media(array( 'attr' => 'url', 'ns' => 'thumbnail', 'link' => PT_GetMedia($feed_item_data->org_thumbnail))) ->appendTo($fl_rss_channel); } } header('Content-type: text/rss+xml'); echo($fl_rss_feed); exit(); } $html_videos = ''; if (!empty($videos)) { foreach ($videos as $key => $video) { $video = PT_GetVideoByID($video, 0, 0, 0); $html_videos .= PT_LoadPage('videos/list', array( 'ID' => $video->id, 'VID_ID' => $video->id, 'TITLE' => $video->title, 'VIEWS' => $video->views, 'VIEWS_NUM' => number_format($video->views), 'USER_DATA' => $video->owner, 'THUMBNAIL' => $video->thumbnail, 'URL' => $video->url, 'TIME' => $video->time_ago, 'DURATION' => $video->duration )); } } if (empty($videos)) { $html_videos = '<div class="text-center no-content-found empty_state"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-video-off"><path d="M16 16v1a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V7a2 2 0 0 1 2-2h2m5.66 0H14a2 2 0 0 1 2 2v3.34l1 1L23 7v10"></path><line x1="1" y1="1" x2="23" y2="23"></line></svg>' . $lang->no_videos_found_for_now . '</div>'; } $pt->videos_count= count($videos); $pt->page = $page; $pt->title = $title . ' | ' . $pt->config->title; $pt->description = $pt->config->description; $pt->keyword = @$pt->config->keyword; $pt->content = PT_LoadPage('videos/content', array( 'TITLE' => $title, 'VIDEOS' => $html_videos, 'TYPE' => $page, 'CATEGORY_ID' => $cateogry_id )); and an html file ( I added line 23): <div class="wo_about_wrapper_parent"> <div class="wo_about_wrapper"> <div class="hero hero-overlay" style="background-color: #033d5d;"> <div class="container"> <h1 class="text-center"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-video"><polygon points="23 7 16 12 23 17 23 7"></polygon><rect x="1" y="5" width="15" height="14" rx="2" ry="2"></rect></svg> {{TITLE}}</h1> </div> </div> <svg id="wave" viewBox="0 0 1440 48" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"><g transform="translate(0.000000, -564.000000)" fill="#033d5d"><g id="Head-background" transform="translate(-168.000000, -346.000000)"><g id="waves-background" transform="translate(888.000000, 934.000000) scale(-1, 1) translate(-888.000000, -934.000000) translate(168.000000, 910.000000)"><path d="M0,14.60779 C101.722445,4.7613277 195.244576,-4.14113188e-14 429,-2.84217094e-14 C732,-1.97619698e-14 798,45.6756592 1089,45.6756592 C1245.83848,45.6756592 1364.64602,29.5028807 1440,14.5904096 C1440,14.60779 1440,48 1440,48 L0,48 C0,48 0.0410082206,34 0,14.60779 Z" id="Path-3-Copy"></path></g></g></g></g></svg> </div> </div> <div class="content pt_shadow pt_page_margin" style="padding-top: 25px;"> <div class="col-md-12"> <div class="upload-head"> <div style="float: right;"> <button class="btn btn-main" data-action="multuple-buy-video" onclick="PT_MultipleBuyVideo();">View all selected</button> </div> <h4><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-search"><circle cx="11" cy="11" r="8"></circle><line x1="21" y1="21" x2="16.65" y2="16.65"></line></svg></h4> <hr> </div> <div class="test"><font color="#696969" font size="3" face="Arial">HELLO<?php echo $text1;?></font> </div> <div class="videos-latest-list row"> {{VIDEOS}} </div> <?php if ($pt->videos_count > 1) { ?> <div class="watch-video-show-more desc load-more" data-type="{{TYPE}}" {{CATEGORY_ID}}> {{LANG show_more}} </div> <?php } ?> <div class="clear"></div> </div> <div class="clear"></div> </div> I am seeing the error on the html page: Notice: Undefined variable: text1 in /home/public_html/themes/videos/content.html on line 23 Any additional guidance to remedy this error is appreciated. Quote Link to comment https://forums.phpfreaks.com/topic/308343-help-with-undefined-variable-error/#findComment-1564542 Share on other sites More sharing options...
requinix Posted February 18, 2019 Share Posted February 18, 2019 The file is being executed through that PT_LoadPage function. Variables defined in your first PHP file will not be accessible in the second file. If you want to send a value through then do it like the other values are being sent through. Quote Link to comment https://forums.phpfreaks.com/topic/308343-help-with-undefined-variable-error/#findComment-1564554 Share on other sites More sharing options...
Chrisj Posted February 18, 2019 Author Share Posted February 18, 2019 Thanks so much again for your reply. Based on your suggestion, I tried this in the php: $pt->content = PT_LoadPage('videos/content', array( 'TITLE' => $title, 'VIDEOS' => $html_videos, 'TYPE' => $page, 'CATEGORY_ID' => $category_id, 'TEXT' => $text1 to try to send the value through, and still see the same error. Any guidance into what I have incorrect here is appreciated. Quote Link to comment https://forums.phpfreaks.com/topic/308343-help-with-undefined-variable-error/#findComment-1564555 Share on other sites More sharing options...
Chrisj Posted February 18, 2019 Author Share Posted February 18, 2019 Thanks for your reply got it now. html needed this: <div class="test">HELLO{{TEXT}}</div> now it displays: "HELLO THIS IS A TEST" Much thanks.I am interested in a little more help, if you are so inclined.My initial intention was to display unique text, when each of three pages appears. When if ($page == 'trending')"unique text 1" displays. When if ($page == 'latest') than "unique text 2" displays, and when if ($page == 'top') than "unique text 3" displays. But, then I got that undefined variable error. Now, I'm trying to have the unique texts display again.I just tried this: $text1 = 'THIS IS A TEST'; $text2 = 'THIS IS TEST 2'; $category_id = ''; $videos = array(); if ($page == 'trending') { $title = $lang->trending; $db->where('privacy', 0); $videos = $db->where('time', time() - 172800, '>')->orderBy('views', 'DESC')->get(T_VIDEOS, $limit); $text1 = 'TEXT'; } else if ($page == 'latest') { $title = $lang->latest_videos; $db->where('privacy', 0); $videos = $db->orderBy('id', 'DESC')->get(T_VIDEOS, $limit); $text2 = 'TEXT2'; } and this in the html code: <div class="test">HELLO{{TEXT}}{{TEXT2}}</div> but it shows me this on all three displayed pages:HELLOTHIS IS A TESTTHIS IS TEST 2 Any guidance as to how to display unique text when each unique page is loaded, will be appreciated. Quote Link to comment https://forums.phpfreaks.com/topic/308343-help-with-undefined-variable-error/#findComment-1564557 Share on other sites More sharing options...
Chrisj Posted February 18, 2019 Author Share Posted February 18, 2019 I also have this in the php (I would have edited the last posting, but I don't see where I can): $pt->content = PT_LoadPage('videos/content', array( 'TITLE' => $title, 'VIDEOS' => $html_videos, 'TYPE' => $page, 'CATEGORY_ID' => $category_id, 'TEXT' => $text1, 'TEXT2' => $text2 Quote Link to comment https://forums.phpfreaks.com/topic/308343-help-with-undefined-variable-error/#findComment-1564558 Share on other sites More sharing options...
requinix Posted February 18, 2019 Share Posted February 18, 2019 That code should work. The problem is somewhere else - either you're looking at the wrong pages or you're somehow not changing the value of those variables. Quote Link to comment https://forums.phpfreaks.com/topic/308343-help-with-undefined-variable-error/#findComment-1564559 Share on other sites More sharing options...
maxxd Posted February 18, 2019 Share Posted February 18, 2019 You're assigning a value to both variables, then sending both variables to PT_LoadPage(), where you print both out. So by showing both, your code is actually doing exactly what you're asking it to do. You've already got some logic to determine the page. Inside those logic blocks, you can set a value to $text that is specific to that page. Then only include $text as a parameter of PT_LoadPage(). That way, you'll know the variable is set no matter what page you're on but it'll be populated with page-specific data. You could also continue the way you're going and look into template conditional logic tags, but at that point you're mixing your logic and display code to an extant that's - IMO - missing the point of using a templating language anyway. Quote Link to comment https://forums.phpfreaks.com/topic/308343-help-with-undefined-variable-error/#findComment-1564576 Share on other sites More sharing options...
Chrisj Posted February 18, 2019 Author Share Posted February 18, 2019 Thanks for your reply. I've now tried this: $text = ''; $category_id = ''; $videos = array(); if ($page == 'trending') { $title = $lang->trending; $db->where('privacy', 0); $videos = $db->where('time', time() - 172800, '>')->orderBy('views', 'DESC')->get(T_VIDEOS, $limit); $text = 'trending text here'; } else if ($page == 'latest') { $title = $lang->latest_videos; $db->where('privacy', 0); $videos = $db->orderBy('id', 'DESC')->get(T_VIDEOS, $limit); $text = 'Latest text here'; } else if ($page == 'top') { $title = $lang->top_videos; $db->where('privacy', 0); $videos = $db->orderBy('views', 'DESC')->get(T_VIDEOS, $limit); $text = 'Top text here'; } along with this: $pt->content = PT_LoadPage('videos/content', array( 'TITLE' => $title, 'VIDEOS' => $html_videos, 'TYPE' => $page, 'CATEGORY_ID' => $category_id, 'TEXT' => $text and the html file page has this: <div class="test">HELLO{{TEXT}}</div> Yet, all that is displayed is: HELLOAny additional guidance is appreciated. Quote Link to comment https://forums.phpfreaks.com/topic/308343-help-with-undefined-variable-error/#findComment-1564591 Share on other sites More sharing options...
requinix Posted February 18, 2019 Share Posted February 18, 2019 Then either none of those conditional blocks are running, or you have the PT_LoadPage code in the wrong place. As a test, make sure this works: 'TEXT' => 'Test text' Quote Link to comment https://forums.phpfreaks.com/topic/308343-help-with-undefined-variable-error/#findComment-1564592 Share on other sites More sharing options...
Chrisj Posted February 18, 2019 Author Share Posted February 18, 2019 Much thanks for your reply. Based on your suggestion, this is displayed (in html page): HELLOTest text Any additional guidance is greatly appreciated Quote Link to comment https://forums.phpfreaks.com/topic/308343-help-with-undefined-variable-error/#findComment-1564593 Share on other sites More sharing options...
requinix Posted February 18, 2019 Share Posted February 18, 2019 Then what I said is still true... Quote Link to comment https://forums.phpfreaks.com/topic/308343-help-with-undefined-variable-error/#findComment-1564595 Share on other sites More sharing options...
maxxd Posted February 18, 2019 Share Posted February 18, 2019 Change this $text = ''; $category_id = ''; $videos = array(); to die("<pre>".var_export($page, true)."</pre>"); $text = ''; $category_id = ''; $videos = array(); and see what it says. Quote Link to comment https://forums.phpfreaks.com/topic/308343-help-with-undefined-variable-error/#findComment-1564598 Share on other sites More sharing options...
Chrisj Posted February 18, 2019 Author Share Posted February 18, 2019 Thanks for your reply. I didn't write this code, I'm just trying to modify it. So, it seems that the load page part should be at the end, which it is, assuming the everything should run first and then you load the page, I would guess. And saying that the conditional blocks aren't working doesn't seem correct. They serve a purpose for the script. Any other ideas will be welcomed Quote Link to comment https://forums.phpfreaks.com/topic/308343-help-with-undefined-variable-error/#findComment-1564599 Share on other sites More sharing options...
requinix Posted February 18, 2019 Share Posted February 18, 2019 I can pretty conclusively tell you that the code is not running as you've portrayed. Programming isn't magical or random: computers follow a very specific set of instructions (code) as entered by a programmer. I could be missing something obvious, but assuming not then the code you've shown will not cause the problems you have. There is something going on that we can't see because we're not sitting in front of your computer, and ignoring us by saying "well that's how it is" and "it's not my code" doesn't help us and more importantly doesn't help you. How about you post the entire contents of the PHP half of this? Unedited, as it is right now. Quote Link to comment https://forums.phpfreaks.com/topic/308343-help-with-undefined-variable-error/#findComment-1564600 Share on other sites More sharing options...
Chrisj Posted February 18, 2019 Author Share Posted February 18, 2019 Thanks for your reply. I added this as per your instructions: die("<pre>".var_export($page, true)."</pre>"); $text = ''; $category_id = ''; $videos = array(); And all I see displayed on the whole html page is simply this: 'category' I look forward to any other guidance. Much thanks again Quote Link to comment https://forums.phpfreaks.com/topic/308343-help-with-undefined-variable-error/#findComment-1564601 Share on other sites More sharing options...
requinix Posted February 18, 2019 Share Posted February 18, 2019 (sigh) Do you know what "category" means? Why you are seeing it on the page now? Where that value is coming from? Quote Link to comment https://forums.phpfreaks.com/topic/308343-help-with-undefined-variable-error/#findComment-1564602 Share on other sites More sharing options...
Chrisj Posted February 18, 2019 Author Share Posted February 18, 2019 Thanks for your reply. You really don't have to be so condescending. I'm just trying to learn. Here's the code as requested. <?php declare( strict_types=1); // these should be set in PHP.ini error_reporting(-1); // set maximum errors ini_set('display_errors' , 'true'); if (empty($_GET['page'])) { header("Location: " . PT_Link('404')); exit(); } $page = PT_Secure($_GET['page']); $limit = 20; $pt->rss_feed = false; $pt->exp_feed = true; $pages = array( 'trending', 'category', 'latest', 'top' ); if (!in_array($page, $pages)) { header("Location: " . PT_Link('404')); exit(); } if (!empty($_GET['feed']) && $_GET['feed'] == 'rss') { $limit = 50; $pt->rss_feed = true; } die("<pre>".var_export($page, true)."</pre>"); $text = ''; $category_id = ''; $videos = array(); if ($page == 'trending') { $title = $lang->trending; $db->where('privacy', 0); $videos = $db->where('time', time() - 172800, '>')->orderBy('views', 'DESC')->get(T_VIDEOS, $limit); $text = 'trending text here'; } else if ($page == 'latest') { $title = $lang->latest_videos; $db->where('privacy', 0); $videos = $db->orderBy('id', 'DESC')->get(T_VIDEOS, $limit); $text = 'Latest text here'; } else if ($page == 'top') { $title = $lang->top_videos; $db->where('privacy', 0); $videos = $db->orderBy('views', 'DESC')->get(T_VIDEOS, $limit); $text = 'Top text here'; } else if ($page == 'category') { if (!empty($_GET['id'])) { if (in_array($_GET['id'], array_keys($categories))) { $category = PT_Secure($_GET['id']); $title = $categories[$category]; $category_id = "data-category='$category'"; $db->where('privacy', 0); $videos = $db->where('category_id', $category)->orderBy('id', 'DESC')->get(T_VIDEOS, $limit); } else { header("Location: " . PT_Link('404')); exit(); } } } use Bhaktaraz\RSSGenerator\Item; use Bhaktaraz\RSSGenerator\Feed; use Bhaktaraz\RSSGenerator\Channel; //Export rss feed if ($pt->rss_feed) { $rss_feed_xml = ""; $fl_rss_feed = new Feed(); $fl_rss_channel = new Channel(); $fl_rss_channel ->title($pt->config->title) ->description($pt->config->description) ->url($pt->config->site_url) ->appendTo($fl_rss_feed); if (is_array($videos)) { foreach ($videos as $feed_item_data) { $feed_item_data = PT_GetVideoByID($feed_item_data, 0, 0, 0); $fl_rss_item = new Item(); $fl_rss_item ->title($feed_item_data->title) ->description($feed_item_data->markup_description) ->url($feed_item_data->url) ->pubDate($feed_item_data->time) ->guid($feed_item_data->url,true) ->media(array( 'attr' => 'url', 'ns' => 'thumbnail', 'link' => PT_GetMedia($feed_item_data->org_thumbnail))) ->appendTo($fl_rss_channel); } } header('Content-type: text/rss+xml'); echo($fl_rss_feed); exit(); } $html_videos = ''; if (!empty($videos)) { foreach ($videos as $key => $video) { $video = PT_GetVideoByID($video, 0, 0, 0); $html_videos .= PT_LoadPage('videos/list', array( 'ID' => $video->id, 'VID_ID' => $video->id, 'TITLE' => $video->title, 'VIEWS' => $video->views, 'VIEWS_NUM' => number_format($video->views), 'USER_DATA' => $video->owner, 'THUMBNAIL' => $video->thumbnail, 'URL' => $video->url, 'TIME' => $video->time_ago, 'DURATION' => $video->duration, //'PRICE' => number_format($video->video_play_price<$config['video_play_price'] ? $config['video_play_price'] : $video->video_play_price) )); } } if (empty($videos)) { $html_videos = '<div class="text-center no-content-found empty_state"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-video-off"><path d="M16 16v1a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V7a2 2 0 0 1 2-2h2m5.66 0H14a2 2 0 0 1 2 2v3.34l1 1L23 7v10"></path><line x1="1" y1="1" x2="23" y2="23"></line></svg>' . $lang->no_videos_found_for_now . '</div>'; } $pt->videos_count= count($videos); $pt->page = $page; $pt->title = $title . ' | ' . $pt->config->title; $pt->description = $pt->config->description; $pt->keyword = @$pt->config->keyword; $pt->content = PT_LoadPage('videos/content', array( 'TITLE' => $title, 'VIDEOS' => $html_videos, 'TYPE' => $page, 'CATEGORY_ID' => $category_id, 'TEXT' => $text )); Quote Link to comment https://forums.phpfreaks.com/topic/308343-help-with-undefined-variable-error/#findComment-1564603 Share on other sites More sharing options...
requinix Posted February 18, 2019 Share Posted February 18, 2019 We're getting a bit out of sync now but whatever. You see "category". That means the code is trying to show the category page. You don't have anything set up for $text on the category page. Quote Link to comment https://forums.phpfreaks.com/topic/308343-help-with-undefined-variable-error/#findComment-1564604 Share on other sites More sharing options...
Chrisj Posted February 18, 2019 Author Share Posted February 18, 2019 Thanks for your reply. I've added: $text = 'category text here'; else if ($page == 'category') { if (!empty($_GET['id'])) { if (in_array($_GET['id'], array_keys($categories))) { $category = PT_Secure($_GET['id']); $title = $categories[$category]; $category_id = "data-category='$category'"; $db->where('privacy', 0); $videos = $db->where('category_id', $category)->orderBy('id', 'DESC')->get(T_VIDEOS, $limit); $text = 'category text here'; } else { header("Location: " . PT_Link('404')); exit(); } } } when I remove die("<pre>".var_export($page, true)."</pre>"); I see this displayed on the html page: HELLOcategory text here when I add it back in I see blank page except for: 'category' And additional guidance is welcomed Quote Link to comment https://forums.phpfreaks.com/topic/308343-help-with-undefined-variable-error/#findComment-1564605 Share on other sites More sharing options...
requinix Posted February 18, 2019 Share Posted February 18, 2019 Guidance for what? Surely you understand what the problem was before? What's left to fix? Quote Link to comment https://forums.phpfreaks.com/topic/308343-help-with-undefined-variable-error/#findComment-1564607 Share on other sites More sharing options...
Chrisj Posted February 18, 2019 Author Share Posted February 18, 2019 Thanks again for your reply. Ultimately, I am looking for guidance to display unique text, when each of three pages appears. I don't see how that has goal has been reached Any additional help is appreciated Quote Link to comment https://forums.phpfreaks.com/topic/308343-help-with-undefined-variable-error/#findComment-1564608 Share on other sites More sharing options...
maxxd Posted February 19, 2019 Share Posted February 19, 2019 The goal has been achieved. The script is doing exactly what you've said you wanted - you're printing custom text on each of the three specified pages; you're just not testing from one of those three pages. If you need custom text per page and don't want to limit it to the three listed pages, you'll have to account for those pages in your conditional logic. Quote Link to comment https://forums.phpfreaks.com/topic/308343-help-with-undefined-variable-error/#findComment-1564611 Share on other sites More sharing options...
Chrisj Posted February 19, 2019 Author Share Posted February 19, 2019 Thanks for your reply. However, I'm not clear on your message. My initial intention was to display separate unique text, on each page, of the three pages. When you say you're "printing custom text on each of the three specified pages", I see that I'm printing the same text on all three pages. Is that what you mean? Also, I'm not clear on this "you're just not testing from one of those three pages". Can you please explain what you mean? You say "If you need custom text per page", - yes, that's what I'd like. "and don't want to limit it to the three listed pages" - I do want it to display on each of just those three pages " you'll have to account for those pages in your conditional logic" so, having if ($page == 'latest') and $text = 'Latest text here'; is accounting for those pages? Any additional guidance is appreciated. Quote Link to comment https://forums.phpfreaks.com/topic/308343-help-with-undefined-variable-error/#findComment-1564612 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.