latest news + link to file instead to an article

Hi,
thank you for your response,
yes the reason is that the client learned to do it this way,, its not familiar with programming , just wants via the article to do this thing, anyway it seems as you mentioned that via image and link tab that is not working and need major changes to php, last but not least any help on that? something to start with, a hint ?
the solution to work with other components its not good for the client....
anyway once again thank you really appreciated
9 years 5 months ago #7 by dc03kks

Please Log in or Create an account to join the conversation.

Hi again,

Finally i managed to do it, you were right that it can be done using the Link A ,B , C of the article image and link tab, so in case you want to upload a new version and have that on it just make the following change to your source mod_latestnewsplusdate\tmpl\default.php

from

<?php // show title ?>
<a class='lndtitle' href="<?php echo $item->link; ?>"><?php echo $item->text; ?></a>
<br/>

to

<?php // show title but link if link has been inserted to the linkA or B or C?>
<?php
$articleLinks = json_decode($item->urls);
$link = $articleLinks->urla;
$linka = $articleLinks->urla;
$linkb = $articleLinks->urlb;
$linkc = $articleLinks->urlc;
$titlea = $articleLinks->urlatext;
$titleb = $articleLinks->urlbtext;
$titlec = $articleLinks->urlctext;
?>
<?php
if ( !empty($articleLinks->urlatext) || !empty($articleLinks->urlbtext) || !empty($articleLinks->urlctext) ) { ?>
<p><a class='lndtitle' title="<?php echo $titlea;?>" href="<?php echo $linka;?>" target="_blank"><?php echo $titlea;?></a></p>
<p><a class='lndtitle' title="<?php echo $titleb?>" href="<?php echo $linkb;?>" target="_blank"><?php echo $titleb;?></a></p>
<p><a class='lndtitle' title="<?php echo $titlec?>" href="<?php echo $linkc;?>" target="_blank"><?php echo $titlec;?></a></p>
<?php } else { ?>
<a class='lndtitle' href="<?php echo $item->link; ?>"><?php echo $item->text; ?></a>
<?php
}
?>
<br/>

once again thank you and keep up the good workl...
9 years 5 months ago #8 by dc03kks

Please Log in or Create an account to join the conversation.

  • Posted by TemplatePlazza (5310) Offline
Hi yes, that's correct ;)
I'd suggest you to copy the template file (modules/mod_latestnewsplusdate/tmpl/default.php) to
templates/your_active_template_name/html/mod_latestnewsplusdate/default.php so your modifications won't be overrided when installing a new version in the future.
9 years 5 months ago #9 by TemplatePlazza

Please Log in or Create an account to join the conversation.

Hi,
yes you are right , :) i m doing that already thank you,

bear in mind that i found 2 bugs on my code,

1. is that in case the article user make a copy paste from the editor the desired file url then it will take smthng like e.g. images/pdf/test.pdf so we need to add the domain name in front
2. in the case of the 1st if we dont put anywere the title of the article so this is confusing for the user in front

i hope u understand the bugs,, its not big deal i will publish the new code asap,, unless u get me 1st ;)
one more time thank you..
9 years 5 months ago #10 by dc03kks

Please Log in or Create an account to join the conversation.

<?php // show title but link if link has been inserted to the linkA or B or C?>
<?php
$articleLinks = json_decode($item->urls);
$linka = $articleLinks->urla;
$linkb = $articleLinks->urlb;
$linkc = $articleLinks->urlc;
$titlea = $articleLinks->urlatext;
$titleb = $articleLinks->urlbtext;
$titlec = $articleLinks->urlctext;
?>
<?php
if ( !empty($articleLinks->urlatext) || !empty($articleLinks->urlbtext) || !empty($articleLinks->urlctext) ) { ?>

<?php echo $item->text; ?>
<p><a class='lndtitle' title="<?php echo $titlea;?>" href="<?php echo $linka;?>" target="_blank"><?php echo $titlea;?></a></p>
<p><a class='lndtitle' title="<?php echo $titleb?>" href="<?php echo $linkb;?>" target="_blank"><?php echo $titleb;?></a></p>
<p><a class='lndtitle' title="<?php echo $titlec?>" href="<?php echo $linkc;?>" target="_blank"><?php echo $titlec;?></a></p>
<?php } else { ?>
<a class='lndtitle' href="<?php echo $item->link; ?>"><?php echo $item->text; ?></a>
<?php
}
?>
<br/>

thank you is working
9 years 5 months ago #11 by dc03kks

Please Log in or Create an account to join the conversation.

  • Posted by TemplatePlazza (5310) Offline
Hi, Ok. glad you found it and solved the issue ;)
9 years 5 months ago #12 by TemplatePlazza

Please Log in or Create an account to join the conversation.

Powered by Kunena Forum