B
B
BandBand2021-07-05 12:32:37
Yii
BandBand, 2021-07-05 12:32:37

About Yii. Stupid question but I'll ask, due to ignorance. There is the following code, which in html displays a link to another site. What does this code mean?

Probably a stupid question for professionals, but I'll ask anyway. There is the following code (names, keywords and references to companies are excluded from the code in order to avoid advertising).
Website made in Yii.
In the source code of the page, just a link to the developer's site is displayed, in the source code is such a piece of code. Please help, what does it mean? To leave just a watermark on the developed site, there is too much code, key phrases and links.

<?php

use yii\helpers\Html;
use yii\helpers\Url;

$link = "https://site.ru";
$title = "Продвижение сайтов в городе";

$controller_site = Yii::$app->controller->id;
$action_site = Yii::$app->controller->action->id;

$arr_article_title = [
  'Продвижение сайтов в городе, 
  'Продвижение сайтов в городе', 
  'Продвижение сайтов в городе', 
  Продвижение сайтов в городе', 
  'Продвижение сайтов в городе'
];
$title_article = $arr_article_title[rand(0, count($arr_article_title)-1)];

$arr_goods_title = [
  'Продвижение сайтов в городе', 
  'Продвижение сайтов в городе', 
  'Продвижение сайтов в городе, 
  'Продвижение сайтов в городе', 
  'Продвижение сайтов в городе'
];
$title_goods = $arr_goods_title[rand(0, count($arr_goods_title)-1)];

$arr_gallery_title = [
  'Продвижение сайтов в городе', 
  'Продвижение сайтов в городе', 
  'Продвижение сайтов в городе', 
  'Продвижение сайтов в городе'
];
$title_gallery = $arr_gallery_title[rand(0, count($arr_gallery_title)-1)];

if($controller_site == "portfolio"){
  $link = "https://site.ru/context";
  $title = $title_gallery;
}
if($controller_site == "page"){
  $link = $action_site == "index" ? "https://site.ru/calculator" : "https://site.ru/promotion";
  $title = $action_site == "index" ? "Продвижение сайтов в городе" : "Продвижение сайтов в городе";
}
if($controller_site == "article"){
  $link = "https://site.ru/seo";
  $title = $title_article;
}
if($controller_site == "catalog"){
  $link = $action_site == "good" ? "https://site.ru/store" : "https://site.ru/site";
  $title = $action_site == "good" ? $title_goods : "Продвижение сайтов в городе";
}

?>
<a href="<?= $link?>" class="logo" target="_blank" title="<?= $title?>">made in <b>Ху*та</b></a>

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Sergey Desh, 2021-07-27
@BandBand

First, we get the controller (controller_site) and action (action_site),
then random values ​​are selected from the arrays:
- arr_article_title
- arr_goods_title
- arr_gallery_title
The requested controllers and actions are checked in the conditions, the link changes depending on this.
Those. on different pages this link will have different attribute "href" and "title"

T
ThunderCat, 2021-07-05
@ThunderCat

The source code of the page displays just a link to the developer's site,
what you see on the page and what the script displays are completely different things, the code may not show anything on the page at all, and nevertheless create and transmit a lot of useful information (the task at home is to find out what kind of information this is).
Please help, what does it mean?
Isn't it easier to ask the person who wrote it? In principle, the answer follows from the previous paragraph.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question