SMFSeo : Subject In Links Finished But

Started by SAFAD, September 21, 2009, 03:06:33 PM

Previous topic - Next topic

Arantor


SAFAD

Best Regards
Sadaoui "SAFAD" Abderrahim - Lead Developer @ Electron Inc.

Arantor

So I get a white screen.

The reason is as I said earlier. $smcFunc hasn't been declared by the time the object buffer is used the first time or so. You may want to check if $smcFunc has actually been declared before trying to use it.

SAFAD

Best Regards
Sadaoui "SAFAD" Abderrahim - Lead Developer @ Electron Inc.

Arantor

No, you haven't, and you can't.

The object buffer is used BEFORE the database abstraction layer meaning that this function is called BEFORE the DAL is loaded, so $smcFunc has not been declared at that point. Make it global all you want, it won't change the fact that $smcFunc is loaded AFTER it is called the first time.

You need to check that $smcFunc['db_query'] is set prior to using because there will be times BEFORE it has been loaded that this function will be called. Fortunately in those cases you can avoid DB queries. (You're going to be seeing MANY queries if you're querying here, by the way.)

SAFAD

I Didn't Really Understand
But
Where To Put My Query & How To Call It ?
Best Regards
Sadaoui "SAFAD" Abderrahim - Lead Developer @ Electron Inc.

Arantor

You have two choices to implement this.

You either rewrite every link generated in SMF, or you modify this function.

However - as I've said there are times when $smcFunc won't exist when you use this.

So, the entire SEO block you've added must be wrapped in a if(isset($smcFunc['db_query'])) { } if statement.

The other problem you're going to have is that there will be times when this is called and you won't have any links in the buffered output, meaning you're going to be doing queries without necessity however that's not something you'll be able to readily avoid - the worst of it should be caught by the if(isset( )) I mention.

SAFAD

QuoteYou either rewrite every link generated in SMF, or you modify this function.
so am not doing anything
QuoteSo, the entire SEO block you've added must be wrapped in a if(isset($smcFunc['db_query'])) { } if statement.[/quota]
and if isnotset ?

and why doesn't normal mysql query work ?
Best Regards
Sadaoui "SAFAD" Abderrahim - Lead Developer @ Electron Inc.

Arantor

Because:
1. The connection to MySQL probably doesn't exist at that point.

2. Even if it does, the connection link identifier probably isn't available.

3. You can't guarantee it'll be running on MySQL; that's the whole idea of the $smcFunc['db_query'] system is that it just works on MySQL, PostgreSQL and SQLite without any changes to SMF or your mod.

4. It will NEVER be approved as a mod if it's not using $smcFunc['db_query'] in 2.0 to do database queries.

SAFAD

QuoteSo, the entire SEO block you've added must be wrapped in a if(isset($smcFunc['db_query'])) { } if statement.
what to do ?
Best Regards
Sadaoui "SAFAD" Abderrahim - Lead Developer @ Electron Inc.

Arantor

Before your new code, add:


if(isset($smcFunc['db_query'])) {


After it, add:

}

SAFAD

I Know this but
what if is not set
it wont work right ?
Best Regards
Sadaoui "SAFAD" Abderrahim - Lead Developer @ Electron Inc.

Arantor

If it isn't set, it won't work. So you have to stop it running that branch of code - or significantly alter the process flow in SMF.

SAFAD

Best Regards
Sadaoui "SAFAD" Abderrahim - Lead Developer @ Electron Inc.

Arantor

You have three routes then.

1. Reorder the process flow of operations in SMF.

2. Rewrite every link by hand.

3. Accept that in the VAST majority of cases where it will be calling for object buffering while $smcFunc is not loaded, that there will be NO LINKS in it, meaning it ISN'T a problem.

Please, just try what I'm suggesting.

SAFAD

Quote
Reorder the process flow of operations in SMF.
am i doing something else
Quote
Rewrite every link by hand.
you mean that every user has to choose best link for his topic ?
Quote
Accept that in the VAST majority of cases where it will be calling for object buffering while $smcFunc is not loaded, that there will be NO LINKS in it, meaning it ISN'T a problem.

Please, just try what I'm suggesting.
if isset
ok lets give it a shot
Best Regards
Sadaoui "SAFAD" Abderrahim - Lead Developer @ Electron Inc.

Arantor

Regarding option 1: you would have to rewrite chunks of index.php, Load.php, Subs.php to reorder what gets called when.

Regarding option 2: No, you're doing a process of replacing content of links. You'd have to edit every link on the page wherever it is issued, in short modding every single place that sends out a <a href>

SAFAD

Regarding your Option 2 :Hell NO !!!!!
Option 1: Can You Give Little More Help
Cuz These Are huge files you know
Best Regards
Sadaoui "SAFAD" Abderrahim - Lead Developer @ Electron Inc.

Arantor

Option 1 is so complex I wouldn't want to do it. The amount of impact across SMF for doing it is colossal.

Did you try option 3? Did it work for you?

SAFAD

Best Regards
Sadaoui "SAFAD" Abderrahim - Lead Developer @ Electron Inc.

Advertisement: