删除标题分隔符主页

时间:2019-12-22 17:26:55

标签: php html title

我有这个用于显示网站标题的php设置:

'''
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class SpawnArea : MonoBehaviour
{

    private Vector3 spawnAreaDrawCenter;
    private Vector3 spawnAreaDraw;

    public float xPos;
    private float yPos = 2;
    public float zPos;

    private Vector3 spawnAreaDrawCenterVoid;
    private Vector3 spawnAreaDrawVoid;

    public float xPosVoid;
    public float zPosVoid;

    private void OnDrawGizmos()
    {
        //Draws spawn area with yellow wire cube
        Vector3 spawnAreaDrawCenter = gameObject.transform.position;
        Vector3 spawnAreaDraw = new Vector3(xPos, yPos, zPos);

        Gizmos.color = Color.yellow;
        Gizmos.DrawWireCube(spawnAreaDrawCenter, spawnAreaDraw);

        //Draws void spawn area with red wire cube (Enemies cannot spawn here)
        Vector3 spawnAreaDrawCenterVoid = gameObject.transform.position;
        Vector3 spawnAreaDrawVoid = new Vector3(xPosVoid, yPos, zPosVoid);

        Gizmos.color = Color.red;
        Gizmos.DrawWireCube(spawnAreaDrawCenterVoid, spawnAreaDrawVoid);

    }

    //Debug Readouts
    private int xRandomSpawnPos;
    private int zRandomSpawnPos;
    public int enemyCount;

    //Editable Values
    public GameObject theEnemy;
    public int enemyAmount;

    // set these to ranges that take their values from the gizmo vector3's
    public int xSpawnAreaPlus;
    public int xSpawnAreaMinus;
    public int zSpawnAreaPlus;
    public int zSpawnAreaMinus;


    public float spawnDelay;

    void Start()
    {

        StartCoroutine(SpawnEnemy());

    }

    IEnumerator SpawnEnemy()

    {

        while (enemyCount < enemyAmount)
        {
            //While the amount of enemies spawned is less that the enemyAmount spawn another after the set delay in a random position within the range
            //The range values are generated from the same vector3 as the 
            xRandomSpawnPos = Random.Range(-(int)spawnAreaDraw.x/2, (int)spawnAreaDraw.x/2);
            zRandomSpawnPos = Random.Range(-(int)spawnAreaDraw.z/2, (int)spawnAreaDraw.z/2);
            Instantiate(theEnemy, new Vector3(xRandomSpawnPos, 1, zRandomSpawnPos), Quaternion.identity);
            yield return new WaitForSeconds(spawnDelay);
            enemyCount += 1;

        }

    }

}

'''

当网站位于主页/着陆页上且未声明<title>Studio X - <?php echo $titlepage; ?></title> 时,我想删除标题分隔符(-)。

1 个答案:

答案 0 :(得分:4)

因此,仅在-不为空时输出$titlepage

<title>Studio X<?php echo !empty($titlepage) ? (' - ' . $titlepage) : ''; ?></title>