Results 1 to 4 of 4

Thread: Small tweak required

  1. #1
    Join Date
    Nov 2011
    Location
    Cider Region
    Posts
    1,132
    Thanks
    158
    Thanked 3 Times in 3 Posts

    Default Small tweak required

    Hello
    If possible i would like some help if i may
    I have a small script that is located inside a php file of which it needs a small tweak.
    To be honest i have looked for the solution but did not find it or it did not work for me due to my lack of this field.
    Basically the script puts my name under EVERY photo i have on my site,this is a bit odd i think.
    I did not want to put the script here as not sure if allowed so i will await a reply.

    Thanks for your time.

  2. #2
    Join Date
    Apr 2008
    Location
    So.Cal
    Posts
    3,643
    Thanks
    63
    Thanked 516 Times in 502 Posts
    Blog Entries
    5

    Default

    well, you won't get any help if you don't post the script.

    Are you looking for advice, so you can do it on your own, or are you asking for paid help?

  3. #3
    Join Date
    Nov 2011
    Location
    Cider Region
    Posts
    1,132
    Thanks
    158
    Thanked 3 Times in 3 Posts

    Default

    I was not sure if i could put it here so i asked first.

    if ($item->owner) {
    $results .= "<li>";
    if ($item->owner->url) {
    $results .= t("By: <a href=\"%owner_url\">%owner_name</a>",
    array("owner_name" => $item->owner->display_name(),
    "owner_url" => $item->owner->url));
    } else {
    $results .= t("By: %owner_name", array("owner_name" => $item->owner->display_name()));
    }
    $results .= "</li>";
    }

  4. #4
    Join Date
    Apr 2008
    Location
    So.Cal
    Posts
    3,643
    Thanks
    63
    Thanked 516 Times in 502 Posts
    Blog Entries
    5

    Default

    Please use the forum's bbcode tags and indent your code to make it more readable:
    Code:
    for php code:       [php]<?php /* code goes here */ ?>[/php]
    for html:           [html]<!-- markup goes here -->[/html]
    for js/css/other:   [code]code goes here[/code]

    PHP Code:
    <?php
    if ($item->owner) {
       
    $results .= "<li>";
          if (
    $item->owner->url) {
             
    $results .= t("By: <a href=\"%owner_url\">%owner_name</a>",
                array(
    "owner_name" => $item->owner->display_name(),
                
    "owner_url" => $item->owner->url));
          } else {
             
    $results .= t("By: %owner_name"
                array(
    "owner_name" => $item->owner->display_name()));
          }
       
    $results .= "</li>";
    }
    There is a lot of context missing that makes this code hard to figure. For example, we don't know what the function t() does, how the object $item is used or the values it contains, and what output you want to end up with (beyond that it seems to be a list, and you mentioned photos).

    This looks like it may be a part of a content management system...? If so, unless someone here happens to be familiar with it, you might get better advice from a forum that is oriented to that CMS specifically. Please give us more info.
    Last edited by traq; 11-27-2011 at 07:07 PM.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •