HTML Logo by World Wide Web Consortium (www.w3.org). Click to learn more about our commitment to accessibility and standards.

Moving forward with Composr

ocPortal has been relaunched as Composr CMS, which is now in beta. ocPortal 9 will be superseded by Composr 10.

Head over to compo.sr for our new site, and to our migration roadmap. Existing ocPortal member accounts have been mirrored.


[SOLVED] Part 2 - Customizing the blog view

Login / Search

 [ Join | More ]
 Add topic 
Posted
Rating:
#50163 (In Topic #10930)
Avatar

Community saint

Last one, then I'll go away ;)

Here is the default view of the blog listings:


Just under the "(1 entries)", I would like to add the contents of the About Me field from the author/member profile. This code works:
{$CPF_VALUE,1}
where 1 is the id of the About Me field. This issue however is that it's not tied to a particular user; there is no apparent loop going on so it shows the first field it finds and repeats the same data for each blog listed. Is this an easy fix up that I can do, or is there more complex php code that needs to go in? Assuming I'm looking the correct place (news.php), I can't find any code that pulls any data other than the author and personal category (which I'm assuming is blog?) information.


Last edit: by SoccerDad

"no violence, no hate, no pain, no enemies
just peace, unity, tolerance and love" - The Beloved

OCP V7 | Advocating monetary reform - FreeOurMoney

Need OCP friendly hosting? Look no further:
Web Hosting, Reseller Hosting, and Dedicated Servers w/cPanel - Elief! - Official hosting partner for ocPortal.
Back to the top
 
Posted
Rating:
#50165
Avatar

Yes this is going to need some PHP changes.

In site/pages/modules/news.php

Code

               $content->attach(do_template('INDEX_SCREEN_FANCIER_ENTRY',array('_GUID'=>'a15a56dd19bc66e4738fb7cff31137a1','IMG'=>$img,'TITLE'=>'','URL'=>$url,'NAME'=>$name,'DESCRIPTION'=>$description)));
–>

Code

               $content->attach(do_template('INDEX_SCREEN_FANCIER_ENTRY',array('_GUID'=>'a15a56dd19bc66e4738fb7cff31137a1','OWNER'=>strval($category['nc_owner']),'IMG'=>$img,'TITLE'=>'','URL'=>$url,'NAME'=>$name,'DESCRIPTION'=>$description)));

We'll include that change in 4.2 so no need to override the file.

Then in the INDEX_SCREEN_FANCIER_ENTRY template…

Code

{+START,IF,{$EQ,{_GUID},a15a56dd19bc66e4738fb7cff31137a1}}
{+START,IF_PASSED,OWNER}
{$CPF_VALUE,1,{OWNER}}
{+END}
{+END}

The 'IF_PASSED' bit is needed as it stops an error message about 'OWNER' not being passed in other uses of this same template. It says "don't worry if OWNER was not passed, just do not interpret this section at all if it wasn't".


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#50173
Avatar

Community saint

Awesome!!! Thanks so much again Chris, works like a dream with one minor change: the IMG bit you posted did not match mine (Ver 4.1.9, the IMG bit was different). Here is what I used (other produced stack trace):

Code

$content->attach(do_template('INDEX_SCREEN_FANCIER_ENTRY',array('_GUID'=>'a15a56dd19bc66e4738fb7cff31137a1','OWNER'=>strval($category['nc_owner']),'IMG'=>$category['nc_img'],'TITLE'=>'','URL'=>$url,'NAME'=>$name,'DESCRIPTION'=>$description)));

"no violence, no hate, no pain, no enemies
just peace, unity, tolerance and love" - The Beloved

OCP V7 | Advocating monetary reform - FreeOurMoney

Need OCP friendly hosting? Look no further:
Web Hosting, Reseller Hosting, and Dedicated Servers w/cPanel - Elief! - Official hosting partner for ocPortal.
Back to the top
 
There are too many online users to list.
Control functions:

Quick reply   Contract

Your name:
Your message: