Skip to:
Content
Pages
Categories
Search
Top
Bottom

I can use bp_get_activity_content_body() on entry.php but how to use on other


  • Pound
    Participant

    @sandmanenter

    I can use bp_get_activity_content_body() on entry.php
    but how can i use it on bp-core-template.php

    Sorry for my poor question, i’m very new for php editor.

Viewing 8 replies - 1 through 8 (of 8 total)

  • Venutius
    Moderator

    @venutius

    I don’t really understand the question, entry.php is a fie aailable for overloading, it’s a template file that displays the activity loop, and bp_get_activity_content_body is a loop function that can be used within it.

    On the other hand, bp-core-template.php is a core file, that should not be edited and it’s not a template file running a loop, why are you looking to edit this? What new function are you trying to add?


    Pound
    Participant

    @b-hana

    dear @venutius
    thank you very much for teach me.
    I want to get first 40 charector of bp_get_activity_content_body() and set to single activity page <title> tag.
    Could you please guide me to do.
    Thank you very much


    Venutius
    Moderator

    @venutius

    you mean members/single/activity.php?


    Pound
    Participant

    @b-hana

    on entry.php i do this

    <script type=”text/javascript”>
    document.title = ‘<?php echo strip_tags(mb_substr(bp_get_activity_content_body(), 0, 40)); ?>’;
    </script>

    this is example of my output http://www.retrophotoclub.com/members/admin/activity/47/

    it is ok to change title tag, but i thing it will change after page is load finished.

    i would like to try this with php with out use javascript.

    Thank you so much @venutius


    Venutius
    Moderator

    @venutius

    I think the issue is that the page title is already going to be set by the time you know the activity content in question, so there’s not a neat solution to this, you either do it in js or you do some kind of string replace in php. I’ve seen solutons like the following:

        include("header.php");
        $title = "TITLE";
    
        $output = str_replace('%TITLE%', $title, $output);
        echo $output;

    Not entirely sure that would work though.


    Pound
    Participant

    @b-hana

    dear @venutius

    now i put

    <?php
    include(“header.php”);
    $title = “TITLE”;

    $output = str_replace(‘%TITLE%’, $title, $output);
    echo $output;
    ?>

    to entry.php and nothing effected, may be i’m not understand how it use.
    so, i will try to study about your advice about 2 day and will report the result to you again.
    Thank you very much.


    Pound
    Participant

    @b-hana

    dear @venutius

    May be i done what my expected,
    “google search” can understand title tag that i set from js.

    document.title = ‘<?php echo strip_tags(mb_substr(bp_get_activity_content_body(), 0, 40)); ?>’;

    and search engine can index website activity by activity
    with title tage from first 40 charactors of ‘activity content body’

    I’d like to say thank you to you again for taking the time to help me.

    search engine understand


    Pound
    Participant

    @b-hana

    may be image not show please http://www.fkx.asia/understandme.jpg

Viewing 8 replies - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.
Skip to toolbar