ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Weblogs in Forums

May 20, 2010 12:31pm

Subscribe [2]
  • #1 / May 20, 2010 12:31pm

    TrevorScott

    19 posts

    I am trying to add a simple weblog into the header of a forum page.Actually it is the same header file/function used across the board. I’ve literally copies and pasted code from sections outside of the forum that works. Am I missing something?

    CP Home > Modules > Discussion Forum > Site Discussions > Templates > Minimalist > Edit Template > Global Templates > Page Header

    {exp:weblog:entries weblog="center_content" dynamic="off" limit="1" url_title="{selected_mall}"}    
    <div id="property-header">    
        <div id="logo_left">{exp:imgsizer:size src="{center_logo}" width="100"  alt="{title}"}</div>
        <div id="content-right">
            <h2>{property_header_title}</h2>
    <p>        {property_header_description}<br />
        </div>    <br />
        {property_header_links}<br />
        <ul id="nav"><br />
            <li><a href="http://{merchants_link}" target="_blank" rel="noopener">Merchants</a></li><br />
            <li><a href="http://{hours_link}" target="_blank" rel="noopener">Hours</a></li><br />
            <li><a href="http://{directions_link}" target="_blank" rel="noopener">Directions</a></li><br />
        </ul><br />
        {/property_header_links}<br />
    </div><br />
    {/exp:weblog:entries}

    EE version: ExpressionEngine 1.6.8
    Forum version: 2.1.2

  • #2 / May 20, 2010 3:59pm

    TrevorScott

    19 posts

    Yet again a total hack…

    $sql = "SELECT t1.*, t2.* FROM exp_weblog_titles AS t1, exp_weblog_data AS t2 WHERE t1.url_title = '".$secureVariable."' AND t2.entry_id = t1.entry_id LIMIT 1";
    $results = mysql_query($sql);
    while($row = mysql_fetch_array($results)) {
        $data = $row[66];
        $image = $row[64];
        $title = $row['title'];
        $tagline = $row[38];
    }
    
    $data = str_replace('{','', $data);
    $data = str_replace('}','', $data);
    $data = explode(':', $data);
    
    $merchUrl = $data[9];
    $hoursUrl = $data[13];
    $direUrl = $data[17];

    The above was hacked into the function page_header() in theme_global from the minimalist forum template. Areas of improvement: target specific fields and implement a JSON parser.

    Sometimes knowing PHP is good and sometimes not. When under the gun, I tend to pull junk like this.

  • #3 / May 20, 2010 5:04pm

    Ingmar

    29245 posts

    I am afraid some custom PHP is your best option here. Glad you got it to work; let me move this thread to Howto.

  • #4 / May 20, 2010 5:09pm

    Lisa Wess

    20502 posts

    There’s no need for PHP, though it is certainly one option.  You could instead run the forums through the main template parser by using:

    {exp:forum}

    in a blank template.  You then visit that template instead of via the forum trigger, and your weblog entries tags and other tags will be parsed appropriately.

    Also - just to clarify, modifying the forum templates is not a hack, it’s a template modification. =)

  • #5 / May 21, 2010 12:13pm

    TrevorScott

    19 posts

    Thank you Ingmar and Lisa. I am going to follow the suggestion of putting the forum in standard template. I can’t tell you how many problems this will solve. Having to pull raw weblogs and stripping out the appropriate data is a bit of an overload.

    One thing I should note: The public website is doing exactly what it needs to do. In the back-end, however, I have lost the ability to modify the theme through the on-board interface. When I select my theme, I am given a “white screen of death”. I am sure it has something to do with my approach. I also linked directly into the database. Given EE’s maturity, this should not have been the case. In any event, the public interface is doing what it should. I will iron out the kinks on the dev server.

    Thank you again Ingram and Lisa! As always, you are rock stars.

  • #6 / May 21, 2010 2:37pm

    Lisa Wess

    20502 posts

    Hi, Cohn Marketing -

    There is likely a hidden PHP Error happening here. If you want to troubleshoot it, please start a new thread down in Technical Support so we can work together to determine what is happening.

    Thank you!

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases