質問編集履歴

2

初心者マークの追加

2018/10/16 13:22

投稿

hitominjar
hitominjar

スコア19

test CHANGED
File without changes
test CHANGED
File without changes

1

ソース内を編集

2018/10/16 13:21

投稿

hitominjar
hitominjar

スコア19

test CHANGED
File without changes
test CHANGED
@@ -38,7 +38,9 @@
38
38
 
39
39
 
40
40
 
41
+ $articleLinks = json_decode($article->urls);
41
42
 
43
+ $link = ($articleLinks->urla ? $articleLinks->urla : $article->link);
42
44
 
43
45
  ?>
44
46
 
@@ -66,11 +68,15 @@
66
68
 
67
69
  <ul class="list-group list-group-flus news-list">
68
70
 
69
- <?php foreach ($list as $item) : ?>
71
+ <?php foreach ($link as $item) :
72
+
73
+ $link = ($link->urla ? $link->urla : $link->link);
74
+
75
+ ?>
70
76
 
71
77
  <li class="pb-2">
72
78
 
73
- <a href="<?php echo $item->link; ?>">
79
+ <a href="<?php echo $link->link; ?>">
74
80
 
75
81
  <span class="news-date"><?php echo JHtml::_('date', $item->created, 'd.m.Y'); ?></span> <span class="news-title ml-3"><?php echo $item->title; ?></span>
76
82
 
@@ -106,6 +112,8 @@
106
112
 
107
113
  下記の記事内のこちらのソースを元に色々試してみたのですが、どのようにしたら「LinkA」を取得できるのかわかりません。
108
114
 
115
+ どうしても、記事ページのURLを取得してしまうようです。
116
+
109
117
  https://stackoverflow.com/questions/21908819/how-to-use-link-a-php-joomla
110
118
 
111
119
  ```