News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

Optimus

Started by Bugo, February 15, 2011, 03:48:12 PM

Previous topic - Next topic

Black Tiger

This is more a php error. It might not have to do with this mod specifically. You could try to increase your php memory size to 128 for example.
If you are not your own host, you could try it via a .htaccess file in your public_html root directory with this statement:
php_value memory_limit 128M

or
<IfModule mod_php5.c>
php_value memory_limit 128M
</IfModule>


If this won't work, you have to ask your host.
Since it's only the last week, you could investigate if you have installed other php things which might have increased the memory usage for php.
Greetings, Black Tiger

B3aker

Quote from: Black Tiger on March 15, 2015, 11:39:58 AM
This is more a php error. It might not have to do with this mod specifically. You could try to increase your php memory size to 128 for example.
If you are not your own host, you could try it via a .htaccess file in your public_html root directory with this statement:
php_value memory_limit 128M

or
<IfModule mod_php5.c>
php_value memory_limit 128M
</IfModule>


If this won't work, you have to ask your host.
Since it's only the last week, you could investigate if you have installed other php things which might have increased the memory usage for php.

Thanks for the response. I'm a little confused though. I don't see any coding like this to my htaccess file. Do I have to add this or edit this?
PSX4Central Since 1999, quite possibly the oldest PlayStation Community on the net

Black Tiger

You have to add it to your .htaccess file indeed.
Greetings, Black Tiger

B3aker

Quote from: Black Tiger on March 15, 2015, 11:58:24 AM
You have to add it to your .htaccess file indeed.

Does it matter where this goes? Sorry for my ignorance. I'm still learning this web stuff :)
PSX4Central Since 1999, quite possibly the oldest PlayStation Community on the net

Black Tiger

As far as I know it does not really matter. I mostly put it at the bottom.

Ah you're still learning. In that case. Check your phpinfo what the memory limit is now, and afterwards. That way you can fastly see if it did change.
Greetings, Black Tiger

B3aker

Yeah. I do my forum more as a hobby. My day job is merchandising for a major retailer. So I'm a little out of my element here ;) I usually only learn something new with web development when something goes wrong, lol.

So I put both the codes in. I checked my memory limit, doesn't seem to have changed.

QuoteResource Limits     memory_limit       96M

EDIT: Seems to have caused a 500 internal server error. Had to remove the code :/
PSX4Central Since 1999, quite possibly the oldest PlayStation Community on the net

Black Tiger

You only need 1 code. If you use both, you have the chance on a 500 internal server error.
In that case only use the second code only, just to be sure.

If that also gives a 500 internal server error, the host has configured things another way. In that case you can try to create a php.ini on your public_html with the following content:
memory_limit = 128M

If that also does not work, you can try to change it internally in the SMF files:
http://wiki.simplemachines.org/smf/What_the_white_screen_of_death_means_when_accessing_admin_or_package_installs#Increase_memory_allocation_in_the_file.28s.29
bottom part of the page.

However, I would suggest to rather ask your host to increase the php memory size for you instead of changing SMF files.
Greetings, Black Tiger

B3aker

Quote from: Black Tiger on March 15, 2015, 01:13:50 PM
You only need 1 code. If you use both, you have the chance on a 500 internal server error.
In that case only use the second code only, just to be sure.

If that also gives a 500 internal server error, the host has configured things another way. In that case you can try to create a php.ini on your public_html with the following content:
memory_limit = 128M

If that also does not work, you can try to change it internally in the SMF files:
http://wiki.simplemachines.org/smf/What_the_white_screen_of_death_means_when_accessing_admin_or_package_installs#Increase_memory_allocation_in_the_file.28s.29
bottom part of the page.

However, I would suggest to rather ask your host to increase the php memory size for you instead of changing SMF files.

Oh yeah. I only used one at a time and tested it. Thanks for you help. I'm reaching out to my host now to see what they can do before I change the SMF files. I'll have an update when I hear back or if this is fixed or not.
PSX4Central Since 1999, quite possibly the oldest PlayStation Community on the net

Low

Hi this mod is changing my URL structure in the canonical source i.e. the forum homepage and all links to it is example.com/index.php but with Optimus activated the canonical in the source shows example.com/.

Please help

Stanyy

Quote from: Armada on December 17, 2014, 11:50:48 AM
I think I've found the problem and fixed it.  :) Hopefully this will help somebody if you have the same problem.

To try and work out what is going on, I had a look at the latest modified files.

I saw something interesting in changes in Load.php by running "diff" to see the changes:


diff Load.php~ Load.php

11c11
<  * @version 2.0.7
---
>  * @version 2.0.9
2746a2747,2753
>
> // Invalidate the opcode cache
> if (function_exists('opcache_invalidate'))
>    opcache_invalidate($cachedir . '/data_' . $key . '.php', true);
>
> if (function_exists('apc_delete_file'))
>    @apc_delete_file($cachedir . '/data_' . $key . '.php');



It's something to do with caching.
So I went to my caching options under Admin > Server Settings > Caching and I changed it from "Level 2" caching to "No caching" then went back in and changed it from "No caching" to "Level 1" caching.

Now it works :)

Armada

Thank you. You just saved me a few hours of headache.

jarin001

Excuse my English. Is there any way to change the OB, instead of the first sentence in the meta description added a larger part of the text? For example, three sentences to 500 characters .. I for subjects sharing on Facebook and that takes data from a meta description on FB page is then as 5 words next to the big picture. Thank you for your help.

roshaoar

Hello,

Just wanted to make a note of something here in case someone else runs into the same problem I had this morning. My forum is a subdirectory and I wanted to make the breadcrumb (linktree in SMF talk) show the site homepage before the forum. This meant adding some lines to load.php, as per here. But on the forum homepage the breadcrumb title over the site homepage was consistently wrong. This is because in Sources\Subs-Optimus.php, there is a line which overwrites what it should be -

$context['linktree'][0]['name'] = $mbname;

Commenting this out solved the problem.

-Johan

Kindred

Quote from: jarin001 on April 28, 2015, 10:20:02 AM
Excuse my English. Is there any way to change the OB, instead of the first sentence in the meta description added a larger part of the text? For example, three sentences to 500 characters .. I for subjects sharing on Facebook and that takes data from a meta description on FB page is then as 5 words next to the big picture. Thank you for your help.

not without recoding the mod...
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

jarin001

I have already found a way, the solution is on page 17.

Kindred

which involved re-coding... :P
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Paracelsus

This MOD is absolutely brilliant, one of the few I would like to see built-in SMF.

Armada

Quote from: Stanyy on April 17, 2015, 04:21:03 PM
Thank you. You just saved me a few hours of headache.

You're most welcome - glad to be of some help. :)
--- SMF Rocks even more than YabbSE---

Armada

Quote from: Kindred on April 28, 2015, 11:30:36 AM
Quote from: jarin001 on April 28, 2015, 10:20:02 AM
Excuse my English. Is there any way to change the OB, instead of the first sentence in the meta description added a larger part of the text? For example, three sentences to 500 characters .. I for subjects sharing on Facebook and that takes data from a meta description on FB page is then as 5 words next to the big picture. Thank you for your help.

not without recoding the mod...

In all fairness, that's probably why the person said "Is there any way to change the OB", and they did excuse for their English too :)
--- SMF Rocks even more than YabbSE---

Armada

Quote from: asura88 on July 23, 2014, 04:13:50 PM
It's a great mod, but the whole META description parsing method is imperfect in my opinion.
For example, if someone started their topic with:
"Hello. (content)", the description would look as follows: "Hello", since it's coded to show only the first sentence (ended with dot or exclamation mark).
I have simplified the description function and it should now correctly deal with this issue. In addition it will now also remove the trimmed (cut) last word from the description and empty spaces from the messages started with new line. I would like to point out that I am still coding noob, but there's nothing advanced, so.

Sources/Subs-Optimus.php
function optimus_meta_teaser()
{
global $context, $txt, $smcFunc;

if ($context['is_poll'])
{
$teaser = $txt['poll'] . ': ' . $context['poll']['question'] . ' (' . $context['page_info']['current_page'] . ')';
}
else
{
$request = $smcFunc['db_query']('', '
SELECT SUBSTRING(body, 1, 200)
FROM {db_prefix}messages
WHERE id_msg = {int:id_msg}
LIMIT 1',
array(
'id_msg' => $context['first_message']
)
);

list ($teaser) = $smcFunc['db_fetch_row']($request);
$smcFunc['db_free_result']($request);
}

$teaser = optimus_meta_chars(str_replace('<br />', ' ', parse_bbc($teaser, false)));
$teaser = trim($teaser);
$teaser = str_replace("&nbsp;", "", $teaser);

if ($smcFunc['strlen']($teaser) < 150) return strip_tags($teaser);

$teaser = preg_replace('/\s+?(\S+)?$/', '', substr($teaser, 0, 150));

return strip_tags($teaser);
}




asura88,

That modification to the mod is good. I've just used it myself.


I've added the thing to strip out the "&nbsb" before it returns the description:

Sources/Subs-Optimus.php
function optimus_meta_teaser()

// RIght neat the end of the function
// I've added this next line too
$teaser = str_replace("&nbsp;", "", $teaser);
return strip_tags($teaser);
}

--- SMF Rocks even more than YabbSE---

tectonny

Bugo Installed in smf 2.1 beta 2 without error, but the redirect after installation I get this error:

Unable to load the 'main' template.

You can solve this problem?

Advertisement: