Viewing 15 posts - 1 through 15 (of 61 total)
  • Author
    Posts
  • ktbgreat2 Friend
    #180902

    Hi there!

    Im loving Jawall, and have been building my site at sillynym.com before I am ready to change the name once its ready.

    Im wondering whether its possible to make a K2 item in the front page direct me to another wall within my site, rather then to the item page? Basically Id just like to make the k2 item a link, I guess rather then an actual item. Id like the K2 item to have a picture and maybe a little description like usual, then when the person clicks it, it will take them straight to a k2 category or tag wall…

    Is this possible?
    Thanks
    Katie

    arucardx Friend
    #467889

    If you look at com_k2ja_wallcategory_item.php, all the hyperlinks to the article content is generated by this code.
    [PHP]<?php echo $this->item->link; ?>[/PHP]

    And the category link is generated by
    [PHP]<?php echo $this->item->category->link; ?>”>[/PHP]

    If you just want to point every article to 1 single page, it’s possible to just hardcode the url into it. But if you want to be abit more dynamic then you need to play around with it. With the example I just gave you, you can also replace all article links to point to its parent category.

    I’m not exactly sure why one would want to do that, since it would point article->category page then article->still same category. But this just a bad idea to get a interactive gallery with just intro text and images.

    ktbgreat2 Friend
    #467972

    Thanks for your help 🙂

    I cant seem to find the file though.. I found com_k2 but I didnt see ja_wall in there anywhere…

    Im slightly new at all of this web design language.. but I have gotten through alot of problems so far, that I didnt understand at first, so Ill try to keep up, and Im sure well get there.

    I think the solution you gave me makes all items direct to one catagory…right? I would like to make one item specifically, eg; “friends” connect to the “friends” catagory

    The item would show up on a wall as usual, with a short description and image, but instead of it going to the item page, it would take me to the category wall…

    So does each k2 item have its own code where I can edit the hyperlink of the preview?

    Thanks for your help so far 🙂
    Katie

    ktbgreat2 Friend
    #467973

    Oh I found the file you were talking about 🙂 It was in the templates, Ja-wall, Html folder..Ok Ill look at it and see if I can understand a bit more.

    Thanks

    arucardx Friend
    #467975

    The example I give you will point your article directly to their parent category instead of the item. When I say parent category, I meant the category which the article is posted in.

    So it should do what you want it to do. Friends connect to the friends category. Others connect to the others category. It’s just 1 like of code but because it’s using $this->item it will return the correct category for that item then reuse the same code again for another item. So it’s something like a foreach loop.

    ktbgreat2 Friend
    #467976

    Thanks..Im just gonna read that a few times to try and let it seep in… I also have items that I dont want to change; that I do want to connect to their item page (like normal)….will that change?

    arucardx Friend
    #467977

    Well… it will change the link for all articles to their category link. So yes it will affect all items. But… hmm if you want some articles to point to their item page while others point to their category… it’s actually possible. All you have to do is insert a another IF statement and then the link to be used.

    The IF statement can do a check against the category id or category name. Then output the link accordingly. So for example, If category name == friends then point to friends category. If != friends then point to item page. This is just an example, you can create more checks by expanding the IF statement to accommodate to different categories.

    ktbgreat2 Friend
    #467978

    Wow interesting! Ive never heard of IF statements.. but I might research them abit, and see if I can understand it abit more. I might come back soon, when I get stuck!

    Good to know its possible though!
    Cheers

    ktbgreat2 Friend
    #467988

    Ok Ive googled the “IF Statements” and I think I understand a bit more now. I can see alot of If statments in the category_item.php file you mentioned earlier. Is this where I would be adding the code?

    Also would you mind giving me a few examples of what the code would look like in full as an example?

    If an item was called “Friends Props” and the category also “Friends Props” what would the code look like? Would it be easier to have the category a different name then the item? Also where abouts in the file should I input the code?

    Thanks again for your help..I really do appreciate it 🙂
    Katie

    arucardx Friend
    #467991

    <?php if ($this->item->category->name == 'Friends Props'): ?>
    <p class="readmore">
    <a class="item-link" href="<?php echo $this->item->category->link; ?>"><?php echo JText::_('K2_WALL_READ_MORE'); ?></a>
    </p>
    <?php else: ?>
    <p class="readmore">
    <a class="item-link" href="<?php echo $this->item->link; ?>"><?php echo JText::_('K2_WALL_READ_MORE'); ?></a>
    </p>
    <?php endif; ?>

    That’s an example code for read more in category_item.php. The first to point item to category link if the category name is “Friends Props”. Else point item to item link if otherwise. The category name and item name don’t have to be the same. The information is all taken from the item ID.

    ktbgreat2 Friend
    #468222

    Hi again!

    Im just about to put this code in that file, but Im just wondering where I will put it exactly;
    Ive found this code here;

    <?php if ($this->item->params->get(‘catItemReadMore’)): ?>
    <p class=”readmore”>
    <a class=”item-link” href=”<?php echo $this->item->link; ?>”>
    <?php echo JText::_(‘K2_WALL_READ_MORE’); ?>
    </a>
    </p>
    <?php endif; ?>
    </div>

    Should I just insert it above this code? Or should I replace this code, with your code?

    Also where I would put the Item ID? Am I replacing the $this-?

    Thanks so much 🙂
    Katie

    arucardx Friend
    #468236

    You will need to replace the existing code if you’re looking to replace its behavior =) You only insert code when you’re trying to exclude or introduce new content. Something like that.

    Here’s how the code should look like. It will check if read more is set to show in the category parameters. If yes, then it will continue where it will check if this item’s category name equals to Friends Props. If yes then this behavior, else that behavior. (Careful not to break the div layers.)
    [PHP]<?php if ($this->item->params->get(‘catItemReadMore’)): ?>
    <?php if ($this->item->category->name == ‘Friends Props’): ?>
    <p class=”readmore”>
    <a class=”item-link” href=”<?php echo $this->item->category->link; ?>”><?php echo JText::_(‘K2_WALL_READ_MORE’); ?></a>
    </p>
    <?php else: ?>
    <p class=”readmore”>
    <a class=”item-link” href=”<?php echo $this->item->link; ?>”><?php echo JText::_(‘K2_WALL_READ_MORE’); ?></a>
    </p>
    <?php endif; ?>
    <?php endif; ?>
    [/PHP]

    As for the usage of $this, you will need to understand what $this actually represents in the logical model by reading the lines of code above and see what is defining the value for $this. Once you can understand what gives variable a value and how a variable gets it’s value, the rest is quite straightforward. The hardest part is trying to find out what syntax to use to get a K2 or Joomla value.

    ktbgreat2 Friend
    #468243

    Thanks again 🙂

    Ill try that code asap.. Im still stuck though on where I should put the Item ID though..;)

    Also once Ive got this sussed, and I want to add another catagory, eg Frasier Props, would it look something like this?

    <?php if ($this->item->params->get(‘catItemReadMore’)): ?>
    <?php if ($this->item->category->name == ‘Frasier Props’): ?>
    <p class=”readmore”>
    <a class=”item-link” href=”<?php echo $this->item->category->link; ?>”><?php echo JText::_(‘K2_WALL_READ_MORE’); ?></a>
    </p>
    <?php if ($this->item->category->name == ‘Friends Props’): ?>
    <p class=”readmore”>
    <a class=”item-link” href=”<?php echo $this->item->category->link; ?>”><?php echo JText::_(‘K2_WALL_READ_MORE’); ?></a>
    </p>
    <?php else: ?>
    <p class=”readmore”>
    <a class=”item-link” href=”<?php echo $this->item->link; ?>”><?php echo JText::_(‘K2_WALL_READ_MORE’); ?></a>
    </p>
    <?php endif; ?>
    <?php endif; ?>

    Thanks… were getting there!

    arucardx Friend
    #468246

    Hmm… the item ID is in $this which is what $this is actually holding as it’s value if I’m not mistaken so I don’t understand why you would need to manually define it.

    As for the php code, what you are doing there is not wrong, there is a slight syntax error but it’s not wrong. It’s however not what some programmers called optimized coding.

    This is how it should look.
    [PHP]
    <?php if ($this->item->params->get(‘catItemReadMore’)): ?>
    <?php if ($this->item->category->name == ‘Frasier Props’ && $this->item->category->name == ‘Friends Props’): ?>
    <p class=”readmore”>
    <a class=”item-link” href=”<?php echo $this->item->category->link; ?>”><?php echo JText::_(‘K2_WALL_READ_MORE’); ?></a>
    </p>
    <?php else: ?>
    <p class=”readmore”>
    <a class=”item-link” href=”<?php echo $this->item->link; ?>”><?php echo JText::_(‘K2_WALL_READ_MORE’); ?></a>
    </p>
    <?php endif; ?>
    [/PHP]

    You should decide whether you want to use those categories in the if statements as includes or use them as excludes if you just want to change the behavior for just some categories but leaving the rest of the categories as default.

    ktbgreat2 Friend
    #468249

    Oh I think I understand…giving an item this particular catagory, automatically gives it this new behaviour…Thats good, sorry for some reason I thought Id have to make the item, then input the item ID in the code somewhere…

    Ok great we might have this thing sussed now!! Ill try it!!

Viewing 15 posts - 1 through 15 (of 61 total)

This topic contains 61 replies, has 2 voices, and was last updated by  arucardx 12 years, 1 month ago.

We moved to new unified forum. Please post all new support queries in our New Forum