The following warnings occurred:
Warning [2] Undefined variable $unreadreports - Line: 26 - File: global.php(961) : eval()'d code PHP 8.2.25 (Linux)
File Line Function
/global.php(961) : eval()'d code 26 errorHandler->error
/global.php 961 eval
/showthread.php 28 require_once





× This forum is read only. As of July 23, 2019, the UserSpice forums have been closed. To receive support, please join our Discord by clicking here. Thank you!

  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
v.5 -- Didn't know where else to post this so...
#11
Agreed. I have to look, but that is pretty similar to how we're doing navigation at the moment. I was mainly focused on the social integration and language parts, so I'll have to look closer at where we're at on that.
  Reply
#12
Should I go ahead and start building the bread crumb system then based on what I've laid out above?
  Reply
#13
If I have time I will try and work on the page_title feature. It won't take very long Smile
  Reply
#14
I've begun working on this and have reached a frustration point. I'm brand new to PDO and the like and I can't seem to get a simple query to work. For identifying the "id" of the page we're on, I've added this simple function to the helpers.php file.


function currentPage_id() {
$current_page_url = currentPage();

$db = DB::getInstance();
$query = $db->query("SELECT id FROM pages WHERE page = users/" . $current_page_url);
$results = $query->first();
$current_page_id = $results->id;

//echo '$current_page_id: ' . $current_page_id;
return $current_page_id;
}


A couple things then...
1.) Why do we need the "$query->first();" part? It seems like "$query->results();" should work, but it doesn't.
2.) The current code constantly returns "1". For example, on the admin.php page, it should return 4.

Any ideas on why this is failing?
  Reply
#15
I am on my phone so please forgive any typos or brief explanations. If you are expecting only one result you want to use First so you don't return a full object that you have to Loop through to get to the right result. If you don't know how many results you're going to get it then you can use results and loop through them.

I think what I would do is not try to concatenate your query right in the middle and I would also find the results to protect against sql injections and things like that.
$url = "users/".$current_page_url

$query = $db->query("SELECT id FROM pages WHERE page = ?",array($url));

That should do the trick or come pretty close to it
  Reply
#16
Ok, that helped.

I'm now working on a loop to create the breadcrumb and this....

do{
$query = $db->query("* FROM pages WHERE id = ?",array($parent_page_id));
$results = $query->results();
$parent_page_path = $results->page;
$parent_page_title = $results->page_title;
$breadcrumb .= '  »  <i class="fa fa-home"></i> ' . $parent_page_title . '';

$new_parent_page_id = $results->parent_page_id;

} while ($new_parent_page_id != 0);

...isn't working. It's not getting all of the info. from the pages table. The $parent_page_id is set correctly.

Thoughts?
  Reply
#17
Don't want to be pushy here, but I'm not sure if this reply got logged/emailed properly. It's on pg. 2 and at the top of this page I see, "This topic contains 14 replies, has 4 voices, and was last updated by dan 15 hours, 41 minutes ago.". However, there is 16 posts in the thread.

Do ya'll see this?
  Reply
#18
The first post does not count as a reply. There is now 16 replies, 17 posts total.
  Reply
#19
OK, thanks for the info. While you're looking at this thread, see anything in my do-while loop that's wrong?
  Reply
#20
I see a few things. I don't do a lot of do while loops, but the first line should be
$query = $db->query("SELECT * FROM pages WHERE id = ?",array($parent_page_id));

The problem with your do while loop is that you have an object instead of an array.
Just for the heck of it, after the results, do
dump($results);
and you can see how that data is formatted.

I know I screwed up some of your concatenation at the end and you'll have to fix that, but I'm guessing you're going to want something like

$query = $db->query("SELECT * FROM pages WHERE id = ?",array($parent_page_id));
$results = $query->results();
foreach($result as $result){
$parent_page_path = $result->page;
$parent_page_title = $result->page_title;
$breadcrumb .= ' » <i class="fa fa-home"></i> ' . $parent_page_title;
$new_parent_page_id = $result->parent_page_id;
}
  Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)