The following warnings occurred:
Warning [2] Undefined variable $unreadreports - Line: 26 - File: global.php(961) : eval()'d code PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/global.php(961) : eval()'d code 26 errorHandler->error
/global.php 961 eval
/printthread.php 16 require_once
Warning [2] Undefined property: MyLanguage::$archive_pages - Line: 2 - File: printthread.php(287) : eval()'d code PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/printthread.php(287) : eval()'d code 2 errorHandler->error
/printthread.php 287 eval
/printthread.php 117 printthread_multipage



UserSpice
v.5 -- Didn't know where else to post this so... - Printable Version

+- UserSpice (https://userspice.com/forums)
+-- Forum: General (https://userspice.com/forums/forumdisplay.php?fid=20)
+--- Forum: UserSpice 5 - Roadmapping the Future (https://userspice.com/forums/forumdisplay.php?fid=31)
+--- Thread: v.5 -- Didn't know where else to post this so... (/showthread.php?tid=319)

Pages: 1 2 3 4


v.5 -- Didn't know where else to post this so... - mudmin - 10-31-2016

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.


v.5 -- Didn't know where else to post this so... - gtilflm - 10-31-2016

Should I go ahead and start building the bread crumb system then based on what I've laid out above?


v.5 -- Didn't know where else to post this so... - Brandin - 10-31-2016

If I have time I will try and work on the page_title feature. It won't take very long Smile


v.5 -- Didn't know where else to post this so... - gtilflm - 11-02-2016

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?


v.5 -- Didn't know where else to post this so... - dan - 11-02-2016

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


v.5 -- Didn't know where else to post this so... - gtilflm - 11-02-2016

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?


v.5 -- Didn't know where else to post this so... - gtilflm - 11-02-2016

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?


v.5 -- Didn't know where else to post this so... - Brandin - 11-02-2016

The first post does not count as a reply. There is now 16 replies, 17 posts total.


v.5 -- Didn't know where else to post this so... - gtilflm - 11-02-2016

OK, thanks for the info. While you're looking at this thread, see anything in my do-while loop that's wrong?


v.5 -- Didn't know where else to post this so... - mudmin - 11-03-2016

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;
}